﻿using netDxf;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestDxfDocument

{

    class nelienvn1
    {
        public static void Cylindricalshankreamer(Dictionary<string, Object> data)  //整体圆柱柄非中心切削扩孔钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            /* double scale = 2;                                                                    
             double pi = Math.PI;
             string path = Convert.ToString(data["path"]);
             double  dconms = 10 ;
             double dcintf = 10  ;
             double ls = 30  ;
             double oal =80  ;
             double lcf = 78 ;
             double lta = 65;
             double dc = 8 ;
             double pl = 1 ;
             double lu = 53;
             double lf = 79 ;
             double fha = 25;
             double fha_ = fha * pi / 180;
            */

            double pi = Math.PI;
            double scale = Convert.ToDouble(data["scale"]); //放大系数
            string path = Convert.ToString(data["path"]);
            double dconms = Convert.ToDouble(data["dconms"])*scale ;
            double dcintf = Convert.ToDouble(data["dcintf"])*scale ; 
            double ls = Convert.ToDouble(data["ls"])*scale ; 
            double oal = Convert.ToDouble(data["oal"])*scale ; 
            double lta = Convert.ToDouble(data["lta"])*scale ; 
            double pl = Convert.ToDouble(data["pl"])*scale ; 
            double fha = Convert.ToDouble(data["fha"]); 
            double fha_ = fha * pi / 180;
          
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, (oal - ls) + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, ls + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Inters(p1, fun.Polar(p1, pi + fha_, oal), p0_2, p0_1);
            Vector2 v3_1 = fun.Polar(p1, pi / 2, dconms / 100);
            Vector2 v3_2 = fun.Inters(p1, fun.Polar(p1, pi + fha_ - 15 * pi / 180, oal), p0_2, p0_1);         
            Line line1 = new Line(v3_1 , v3_2);
            Arc arc1= fun.DrawArc5(p1, line1, p3);
            Vector2 p4= fun.Inters(p1, fun.Polar(p1, pi + fha_-3*pi/180, oal), p0_2, p0_1);
            Vector2 v4_2= fun.Inters(p1, fun.Polar(p1, pi + fha_ - 18 * pi / 180, oal), p0_2, p0_1);
            Line line2 = new Line(v3_1, v4_2);
            Arc arc2 = fun.DrawArc5(p1, line2, p4);
            Vector2 p5 = fun.PointRotate(p3, p1, pi);
            Arc arc3 = fun.DrawArc4(p5, arc1.Radius, p3,0);
            Arc arc4 = fun.DrawArc4(p5, arc2.Radius, p4,0);
            Vector2 v4_1 = fun.Polar(p3, pi, fun.CalDistance(p3, p4) / 2.0);
            Vector2 v4_3 = fun.Polar(v4_1, pi / 3, oal);
            Vector2 v4_4 = fun.Polar(v4_1, pi + pi / 3, oal);
            Vector2 p6 = fun.Inters1(v4_1, v4_3, arc2,1);
            Vector2 p7 = fun.Inters1(v4_1, v4_4, arc3,0);
            Vector2 v2_1 = fun.Polar(p2, pi / -2, 0.1);
            Vector2 v2_2= fun.Polar(v2_1 , pi, oal);
            Line line3 = new Line(v2_2, v2_1);
            Arc arc5 = fun.DrawArc5(p7, line3, p2);
            
            Vector2 v9_1=fun.Polar(p0, pi, -(p3.X - p0.X)/2.1);
            Vector2 v9_2 = fun.Polar(v9_1 , pi / -2, oal);
            Vector2 p9 = fun.Inters1(v9_1 , v9_2, arc5, 1);
            Vector2 v8_1 = fun.Polar(p0, pi, 7/12.0*-(p7.X - p0.X) );
            Vector2 v8_2 = fun.Polar(v8_1, pi / -2, oal);
            Vector2 p8 = fun.Inters1(v8_1, v8_2, arc5, 1);
            Vector2 p10 = fun.Polar(p8, fun.CalAngle(p8, p9) + pi / 3, fun.CalDistance(p8, p9) * 2-(p9.Y -p8.Y ) );
            Vector2 v10 = fun.Polar(p10, fun.CalAngle(p8, p10) - pi / 2, oal);
            Vector2 v11=fun .Polar(p9, fun.CalAngle(p9, p8) -120*pi/180, fun.CalDistance(p8, p9) * 2 );
            Vector2 p11 = fun.Inters(v10, p10, p9, v11);
            Line line4 = new Line(p8, p10);
            Line line5 = new Line(p9, p11);
            Line line6 = new Line(p1, p2);
            Arc arc6 = fun.DrawArc4(p11, fun.CalDistance(p10, p11) / 2.0, p10, 0);
            Vector2 v12_1 = fun.Polar(p3, fun.CalAngle(p3, Pus.ToV2(arc3.Center)), fun.CalDistance(p3, Pus.ToV2(arc3.Center)) * 2);
            Arc arc7 = fun.DrawArc4(v12_1, fun.CalDistance(p3, Pus.ToV2(arc3.Center)), p3,0);
            Vector2 v12_2 = fun.Polar(p7, pi, oal);
            Vector2 p12 = fun.Inters1(p7, v12_2, arc7, 0);
            Arc arc8 = fun.DrawArc4(p12, arc3.Radius, p5, 0);

            Vector2 p13 = fun.Polar(p3, pi, fun.CalDistance(p12, p7));
            Vector2 p14 = fun.Polar(p13, pi, fun.CalDistance(p3, p4));
            Arc arc9 = fun.DrawArc4(p6, arc1.Radius, p13, 0);
            Arc arc10 = fun.DrawArc4(p6, arc2.Radius, p14, 0);
            Vector2 v15 = fun.Polar(p6, pi, oal) ;
            Vector2 p15 = fun.Inters1(p6, v15, arc10, 0);
            Vector2 p16 = fun.Polar(p5, pi, fun.CalDistance(p12, p7));
            Arc arc11 = fun.DrawArc4(p16, arc10.Radius , p14, 0);
            Arc arc12 = fun.DrawArc3 (p16, p12 , p13);
            Line line9 = new Line(p5, p16);
            Vector2 p17 = fun.Polar(p2, pi, oal - ls - pl+oal/18.0);
            Vector2 p18 = fun.mirrorpoint(p17, p0_1, p0_2);
            Vector2 p19 = fun.Polar(p13, pi, fun.CalDistance(p3, p13));
            Vector2 p20 = fun.Polar(p19, pi, fun.CalDistance(p13, p14));
            Arc arc13 = fun.DrawArc4(p15, arc9.Radius, p19, 0);
            Arc arc14 = fun.DrawArc4(p15, arc10.Radius, p20, 0);
            Vector2 v19 = fun.Polar(p15, fun.CalAngle(p15, Pus.ToV2(arc13.Center)), fun.CalDistance(p15, Pus.ToV2(arc13.Center))*2);
            Vector2 v20 = fun.Polar(p15, fun.CalAngle(p15, Pus.ToV2(arc14.Center)), fun.CalDistance(p15, Pus.ToV2(arc14.Center)) * 2);
            Arc arc15 = fun.DrawArc4(p15, arc13.Radius, v19,0);
            Arc arc16 = fun.DrawArc4(p15, arc14.Radius, v20,0);
            Vector2 v21 = fun.Polar(p18, pi / -2 - 0.1 * pi / 180, oal);
            Vector2 p21 = fun.Inters1(p18, v21, arc16, 1);
            Vector2 p22 = fun.Inters1(p18, v21, arc15, 1);
            Line line17 = new Line(p21, p22);
            Arc arc17 = fun.DrawArc4(p15, arc16.Radius, p21,0);
            Arc arc18 = fun.DrawArc4(p15, arc15.Radius, p22, 0);
            Vector2 p23 = fun.Polar(p18, pi + pi / 4, pl);
            Vector2 v23 = fun.Polar(p23, pi / -2 - 0.1 * pi / 180,oal);
            Vector2 p24 = fun.Inters(p21, fun.Polar(p21, pi - pi / 4, oal), p23, v23);
            Vector2 p25 = fun.Inters(p22, fun.Polar(p22, pi - pi / 4, oal), p23, v23);
            Line line19 = new Line(p21, p24);
            Line line20 = new Line(p22, p25);
            Line line21 = new Line(p23, p25);
            Line line22 = new Line(p18, p23);
            Vector2 v26_ = fun.Polar (fun .Polar (p15,pi/2,dconms /10*8), pi, oal);
            Vector2 p26 = fun.Inters1(p15, v26_, arc17, 0);
            Arc arc19 = fun.DrawArc4(p26, arc17.Radius, p18, 0);
            Vector2 v27 = fun.Polar(p26, pi / -2 - 12 * pi / 180, oal);
            Vector2 p27 = fun.Inters (p16, fun.Polar(p16, pi, oal), p26, v27);
            Line line23 = new Line(p16, p27);
            Vector2 v27_1 = fun.Polar(p27, 166 * pi / 180, oal);
            Vector2 p28 = fun.Inters(p27, v27_1, p22, fun.Polar(p22, pi / -2, oal));
            Vector2 v28_1 = fun.Polar(p27, pi / -2, 0.01);
            Vector2 v28_2 = fun.Polar(v28_1, pi, oal);
            Line line24 = new Line(v28_1, v28_2);
            Arc arc20 = fun.DrawArc5(p28, line24, p27);
            Vector2 p29 = fun.Polar(p28, fun.CalAngle(p22, p25), fun.CalDistance(p22, p25));
            Line line25 = new Line(p25, p29);
            Line line26 = new Line(p29, p28);
            Vector2 p30 = fun.Polar(p1, 0, ls-1);
            Vector2 p31 = fun.Polar(p30, pi / -4, Math.Sqrt(2));
            Vector2 p32 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p33 = fun.mirrorpoint(p31, p0_1, p0_2);
            var polyline1 = Pus.AddPointsToLwPolyLine(p1,p30,p32,p33,p31,p30,p32,p2,p1 );
            Vector2 p34 = fun.Polar(p29, pi, oal / 2.0);
            Vector2 p35 = fun.Polar(p34, pi / 2, dconms / 2.0);
            Vector2 p36 = fun.Polar(p35, pi / 2, dconms / 2.0);
            Vector2 p37 = fun.Polar(p35, pi, dconms);
            Vector2 p38 = fun.Polar(p36, pi, dconms);
            Vector2 p39 = fun.Polar(p38, -15 * pi / 180, dconms / 5.0 / Math.Cos(15 * pi / 180));
            Vector2 p40 = fun.Polar(p39, 15 * pi / 180, dconms / 5.0 / Math.Sin(75 * pi / 180));
            Vector2 p41 = fun.Polar(p40, -15 * pi / 180, dconms / 5.0 / Math.Cos(15 * pi / 180));
            Vector2 p42= fun.Polar(p41, 15 * pi / 180, dconms / 5.0 / Math.Sin(75 * pi / 180));

            Vector2 p43 = fun.mirrorpoint(p35, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p36, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p38, p0_1, p0_2);
            Vector2 p47 = fun.mirrorpoint(p39, p0_1, p0_2);
            Vector2 p48 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p49 = fun.mirrorpoint(p41, p0_1, p0_2);
            Vector2 p50 = fun.mirrorpoint(p42, p0_1, p0_2);
            var polyline3 = Pus.AddPointsToLwPolyLine(p44, p43, p45, p46, p47, p48, p49, p50, p44);
            var polyline2 = Pus.AddPointsToLwPolyLine(p36,p35,p37,p38,p39,p40,p41,p42,p36);
            dxf.AddEntity(new EntityObject[] {  arc1,arc2,arc3,arc4 ,arc5,arc6 ,arc8,arc9,arc10,arc11,arc12,arc13,arc14,arc17
                ,arc18,arc19,arc20
                ,line4,line5,line6,line9,line17,line19,line20,line21,line22,line23,line25 ,line26   
                ,polyline1,polyline2,polyline3
            });
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);
            fun.drawBArc(dxf, arc10, 0.5, contour);
            fun.drawBArc(dxf, arc11, 0.5, contour);
            fun.drawBArc(dxf, arc12, 0.5, contour);
            fun.drawBArc(dxf, arc13, 0.5, contour);
            fun.drawBArc(dxf, arc14, 0.5, contour);
            fun.drawBArc(dxf, arc17, 0.5, contour);
            fun.drawBArc(dxf, arc18, 0.5, contour);
            fun.drawBArc(dxf, arc19, 0.5, contour);
            fun.drawBArc(dxf, arc20, 0.5, contour);
            fun.drawBline(dxf, line4, 0.5, contour);
            fun.drawBline(dxf, line5, 0.5, contour);
            fun.drawBline(dxf, line6, 0.5, contour);
            fun.drawBline(dxf, line9, 0.5, contour);
            fun.drawBline(dxf, line17, 0.5, contour);
            fun.drawBline(dxf, line19, 0.5, contour);
            fun.drawBline(dxf, line20, 0.5, contour);
            fun.drawBline(dxf, line21, 0.5, contour);
            fun.drawBline(dxf, line22, 0.5, contour);
            fun.drawBline(dxf, line23, 0.5, contour);
            fun.drawBline(dxf, line25, 0.5, contour);
            fun.drawBline(dxf, line26, 0.5, contour);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);


            //标注
            Vector2 o1_1 = fun.Polar(p23, 0,oal  );
            Vector2 o1 = fun.Inters1(p23, o1_1, arc2, 0);
            Vector2 o2_1 = fun.Polar(p9, 0, 2.68/5.0*(-(p9.X -p2.X )));
            Vector2 o2_2 = fun.Polar(o2_1 , pi / 2, oal);
            Vector2 o2 = fun.Inters1(o2_1, o2_2, arc6, 0);
            Vector2 o3 = fun.Polar(p18, 0, lta);
            Vector2 o4 = fun .Polar (o3, pi / 2, dconms / 2.0 );
            Vector2 o5 = fun.Polar(o4, pi / 4, dconms / 10.0);
            Vector2 o6 = fun.Polar(o5, 0, dconms / 6.0);
            Vector2 o7 = fun.mirrorpoint(o4, p0_1, p0_2);
            Vector2 o8 = fun.mirrorpoint(o5, p0_1, p0_2);
            Vector2 o9 = fun.mirrorpoint(o6, p0_1, p0_2);

            Vector2 o10 = fun.Polar(p24, pi / -3, 1.7);
            Vector2 o11 = fun.Polar(o10, pi / -3, dconms);
            Vector2 o12 = fun.Polar(o11, pi / -2, 1.2);

            Vector2 o13 = fun.Polar(p29, pi + pi / 4, 1.7);
            Vector2 o14 = fun.Polar(o13,pi+pi/4, dconms);
            Vector2 o15 = fun.Polar(o14, pi / -2, 1.7*0.5);

            Vector2 o16 = fun.Polar(o3, pi / -2, dconms/2.0);
            Vector2 o17 = fun.Polar(o16, pi / -4, dconms);
            Vector2 o18 = fun.Polar(o17, pi / -2, 1.2);

            Vector2 o19 = fun.Polar(p33, pi / 2, dconms / 2.0 - 1);
            Vector2 o20 = fun.Polar(o19, pi / -3, 1.7 * 0.5);
            Vector2 o21 = fun.Polar(o20, pi / -3, dconms);
            Vector2 o22 = fun.Polar(o21, pi / -2, 1.2);

            Vector2 o23 = fun.Polar(p15, pi / 2, dcintf * 3.5);

            Line line27 = new Line(o4, o7);
            Line line28 = new Line(o4, o5);
            Line line29 = new Line(o5, o6);
            Line line31 = new Line(o4, o7);
            Line line32 = new Line(o7, o8);
            Line line33 = new Line(o8, o9);
            Line line30 = new Line(p0_1, p0_2);
            Line line34 = new Line(o10, o11);
            Line line35 = new Line(o13, o14);
            Line line36 = new Line(o16, o17);
            Line line37 = new Line(o20, o21);
            line27.Lineweight = Lineweight.W35;//Lineweight指线宽
            line27.Layer = refin;//Layer指图层
            line27.LinetypeScale = 5;//指线性比例
            line27.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line27); //提取
            line28.Lineweight = Lineweight.W35;//Lineweight指线宽
            line28.Layer = refin;//Layer指图层
            line28.LinetypeScale = 5;//指线性比例
            line28.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line28); //提取
            line29.Lineweight = Lineweight.W35;//Lineweight指线宽
            line29.Layer = refin;//Layer指图层
            line29.LinetypeScale = 5;//指线性比例
            line29.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line29); //提取
            line30.Lineweight = Lineweight.W25;//Lineweight指线宽
            line30.Layer = center;//Layer指图层
            line30.LinetypeScale = 5;//指线性比例
            line30.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line30); //提取
            line31.Lineweight = Lineweight.W35;//Lineweight指线宽
            line31.Layer = refin;//Layer指图层
            line31.LinetypeScale = 5;//指线性比例
            line31.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line31); //提取
            line32.Lineweight = Lineweight.W35;//Lineweight指线宽
            line32.Layer = refin;//Layer指图层
            line32.LinetypeScale = 5;//指线性比例
            line32.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line32); //提取
            line33.Lineweight = Lineweight.W35;//Lineweight指线宽
            line33.Layer = refin;//Layer指图层
            line33.LinetypeScale = 5;//指线性比例
            line33.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line33); //提取
            line34.Lineweight = Lineweight.W35;//Lineweight指线宽
            dxf.AddEntity(line34); //提取
            line35.Lineweight = Lineweight.W35;//Lineweight指线宽
            dxf.AddEntity(line35); //提取
            line36.Lineweight = Lineweight.W35;//Lineweight指线宽
            dxf.AddEntity(line36); //提取
            line37.Lineweight = Lineweight.W35;//Lineweight指线宽          
            dxf.AddEntity(line37); //提取

            fun.dimrot1(dxf, p23, o1, 0, 10+dcintf  / 2, 2, 1.2, 1.6, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p23,o2  , 0, 20+dcintf  , 2, 1.2, 1.6, 0.9, "LCF=", "", "");
            fun.dimrot1(dxf, p18, o3, 0, 30+dcintf , 2, 1.2, 1.6, 0.9, "LTA="+lta/scale, "", "");
            fun.dimrot1(dxf, p23, o3, 0, 40+dcintf, 2, 1.2, 1.6, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, p23, p31 , 0, 50+dcintf, 2, 1.2, 1.6, 0.9, "OAL="+oal/scale , "", "");
            fun.dimrot1(dxf, p2, p33, 180, dcintf, 2, 1.2, 1.6, 0.9, "LS="+ls/scale , "", "");
            fun.dimrot1(dxf, p29, p28 , 180, dcintf*2 - (p28.Y -p29.Y )/2.0+(p33.Y -p28.Y )/2.0, 2, 1.2, 1.6, 0.9, "PL="+pl/scale , "", "");
            fun.dimrot1(dxf, p28, p33, 180, dcintf*2, 2, 1.2, 1.6, 0.9, "LF", "", "");
            fun.dimrot1(dxf, p30, p33, -90, dcintf , 2, 1.2, 1.6, 0.9, "DCONMS="+dconms/scale , "", "");
            fun.dimrot1(dxf, p23, p25, 90, dcintf , 2, 1.2, 1.6, 0.9, "DCINTF="+dcintf/scale , "", "");
            fun.dimrot1(dxf, p18, p27, 90, dcintf * 2, 2, 1.2, 1.6, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p45, p37, 90, 0.1, 2, 1.2, 1.6, 0.9, "PHD", "", "");

            fun.jdbz2(dxf, new Line(p29,fun .Polar ( p29,fun .CalAngle (p28,p29),0.1)),new Line(p23,fun .Polar ( p23,fun.CalAngle (p18,p23),0.1)),dcintf *3, 1.6, 1.2, 0.9, "SIG", " ", " ");
            fun.jdbz2(dxf, new Line(p5,p16), new Line(p4, fun.Polar(p4,pi+fha_+15*pi/180 , 0.1)), dcintf , 1.6, 1.2, 0.9, "FHA", " ", " ");

            fun.Axis(dxf, fun.Polar(p33, pi / -2, dcintf * 3), 0, -90, "Z", "X", "Y", 0.5, 1.2, 1);
            fun.Axis(dxf, fun.Polar(p33, pi / 2, dconms/2.0-1 ), 0, -90, "", "", "", 0.5, 1.2, 1);
            fun.Axis(dxf, fun .Polar (o3,pi/-2,dconms /2.0) , 0, -90, "", "", "", 0.5, 1.2, 1);
            fun.Axis(dxf, p24 , 0, -90, "", "", "", 0.5, 1.2, 1);

            Text txt1 = new Text("CIP", o12 , 1.2, 2); 
            dxf.AddEntity(txt1);
            Text txt2 = new Text("CRP", o15, 1.2, 2);
            dxf.AddEntity(txt2);
            Text txt3 = new Text("MCS", o18, 1.2, 2);
            dxf.AddEntity(txt3);
            Text txt4 = new Text("PCS", o22, 1.2, 2);
            dxf.AddEntity(txt4);
            Text txt5 = new Text("ISYC=302_03", o23, 1.2, 2);
            dxf.AddEntity(txt5);
            Circle circle1 = new Circle(Pus .ToV3 (p29,0),1.7*0.5);//圆
            circle1.Lineweight = netDxf.Lineweight.W35;
            dxf.AddEntity(circle1);

            // Line line1000 = new Line(p28, fun.Polar(p28, pi, oal));
            // dxf.AddEntity(line1000);

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            //double scale = Convert.ToDouble(data["scale"]); //放大系数
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }


        public static void ISYC_302_03(Dictionary<string, Object> data)  //整体圆柱柄非中心切削扩孔钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            /* double scale = 2;                                                                    
             double pi = Math.PI;
             string path = Convert.ToString(data["path"]);
             double  dconms = 10 ;
             double dcintf = 10  ;
             double ls = 30  ;
             double oal =80  ;
             double lcf = 78 ;
             double lta = 65;
             double dc = 8 ;
             double pl = 1 ;
             double lu = 53;
             double lf = 79 ;
             double fha = 25;
             double fha_ = fha * pi / 180;
            */

            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dconms = Convert.ToDouble(data["dconms"]);
            double dcintf = Convert.ToDouble(data["dcintf"]); ;
            double ls = Convert.ToDouble(data["ls"]); ;
            double oal = Convert.ToDouble(data["oal"]); ;
            double lta = Convert.ToDouble(data["lta"]); ;
            double pl = Convert.ToDouble(data["pl"]); ;
            double fha = Convert.ToDouble(data["fha"]); ;
            double fha_ = fha * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, (oal - ls) + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, ls + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Inters(p1, fun.Polar(p1, pi + fha_, oal), p0_2, p0_1);
            Vector2 v3_1 = fun.Polar(p1, pi / 2, dconms / 100);
            Vector2 v3_2 = fun.Inters(p1, fun.Polar(p1, pi + fha_ - 15 * pi / 180, oal), p0_2, p0_1);
            Line line1 = new Line(v3_1, v3_2);
            Arc arc1 = fun.DrawArc5(p1, line1, p3);
            Vector2 p4 = fun.Inters(p1, fun.Polar(p1, pi + fha_ - 3 * pi / 180, oal), p0_2, p0_1);
            Vector2 v4_2 = fun.Inters(p1, fun.Polar(p1, pi + fha_ - 18 * pi / 180, oal), p0_2, p0_1);
            Line line2 = new Line(v3_1, v4_2);
            Arc arc2 = fun.DrawArc5(p1, line2, p4);
            Vector2 p5 = fun.PointRotate(p3, p1, pi);
            Arc arc3 = fun.DrawArc4(p5, arc1.Radius, p3, 0);
            Arc arc4 = fun.DrawArc4(p5, arc2.Radius, p4, 0);
            Vector2 v4_1 = fun.Polar(p3, pi, fun.CalDistance(p3, p4) / 2.0);
            Vector2 v4_3 = fun.Polar(v4_1, pi / 3, oal);
            Vector2 v4_4 = fun.Polar(v4_1, pi + pi / 3, oal);
            Vector2 p6 = fun.Inters1(v4_1, v4_3, arc2, 1);
            Vector2 p7 = fun.Inters1(v4_1, v4_4, arc3, 0);
            Vector2 v2_1 = fun.Polar(p2, pi / -2, 0.1);
            Vector2 v2_2 = fun.Polar(v2_1, pi, oal);
            Line line3 = new Line(v2_2, v2_1);
            Arc arc5 = fun.DrawArc5(p7, line3, p2);

            Vector2 v9_1 = fun.Polar(p0, pi, -(p3.X - p0.X) / 2.1);
            Vector2 v9_2 = fun.Polar(v9_1, pi / -2, oal);
            Vector2 p9 = fun.Inters1(v9_1, v9_2, arc5, 1);
            Vector2 v8_1 = fun.Polar(p0, pi, 7 / 12.0 * -(p7.X - p0.X));
            Vector2 v8_2 = fun.Polar(v8_1, pi / -2, oal);
            Vector2 p8 = fun.Inters1(v8_1, v8_2, arc5, 1);
            Vector2 p10 = fun.Polar(p8, fun.CalAngle(p8, p9) + pi / 3, fun.CalDistance(p8, p9) * 2 - (p9.Y - p8.Y));
            Vector2 v10 = fun.Polar(p10, fun.CalAngle(p8, p10) - pi / 2, oal);
            Vector2 v11 = fun.Polar(p9, fun.CalAngle(p9, p8) - 120 * pi / 180, fun.CalDistance(p8, p9) * 2);
            Vector2 p11 = fun.Inters(v10, p10, p9, v11);
            Line line4 = new Line(p8, p10);
            Line line5 = new Line(p9, p11);
            Line line6 = new Line(p1, p2);
            Arc arc6 = fun.DrawArc4(p11, fun.CalDistance(p10, p11) / 2.0, p10, 0);
            Vector2 v12_1 = fun.Polar(p3, fun.CalAngle(p3, Pus.ToV2(arc3.Center)), fun.CalDistance(p3, Pus.ToV2(arc3.Center)) * 2);
            Arc arc7 = fun.DrawArc4(v12_1, fun.CalDistance(p3, Pus.ToV2(arc3.Center)), p3, 0);
            Vector2 v12_2 = fun.Polar(p7, pi, oal);
            Vector2 p12 = fun.Inters1(p7, v12_2, arc7, 0);
            Arc arc8 = fun.DrawArc4(p12, arc3.Radius, p5, 0);

            Vector2 p13 = fun.Polar(p3, pi, fun.CalDistance(p12, p7));
            Vector2 p14 = fun.Polar(p13, pi, fun.CalDistance(p3, p4));
            Arc arc9 = fun.DrawArc4(p6, arc1.Radius, p13, 0);
            Arc arc10 = fun.DrawArc4(p6, arc2.Radius, p14, 0);
            Vector2 v15 = fun.Polar(p6, pi, oal);
            Vector2 p15 = fun.Inters1(p6, v15, arc10, 0);
            Vector2 p16 = fun.Polar(p5, pi, fun.CalDistance(p12, p7));
            Arc arc11 = fun.DrawArc4(p16, arc10.Radius, p14, 0);
            Arc arc12 = fun.DrawArc3(p16, p12, p13);
            Line line9 = new Line(p5, p16);
            Vector2 p17 = fun.Polar(p2, pi, oal - ls - pl + oal / 18.0);
            Vector2 p18 = fun.mirrorpoint(p17, p0_1, p0_2);
            Vector2 p19 = fun.Polar(p13, pi, fun.CalDistance(p3, p13));
            Vector2 p20 = fun.Polar(p19, pi, fun.CalDistance(p13, p14));
            Arc arc13 = fun.DrawArc4(p15, arc9.Radius, p19, 0);
            Arc arc14 = fun.DrawArc4(p15, arc10.Radius, p20, 0);
            Vector2 v19 = fun.Polar(p15, fun.CalAngle(p15, Pus.ToV2(arc13.Center)), fun.CalDistance(p15, Pus.ToV2(arc13.Center)) * 2);
            Vector2 v20 = fun.Polar(p15, fun.CalAngle(p15, Pus.ToV2(arc14.Center)), fun.CalDistance(p15, Pus.ToV2(arc14.Center)) * 2);
            Arc arc15 = fun.DrawArc4(p15, arc13.Radius, v19, 0);
            Arc arc16 = fun.DrawArc4(p15, arc14.Radius, v20, 0);
            Vector2 v21 = fun.Polar(p18, pi / -2 - 0.1 * pi / 180, oal);
            Vector2 p21 = fun.Inters1(p18, v21, arc16, 1);
            Vector2 p22 = fun.Inters1(p18, v21, arc15, 1);
            Line line17 = new Line(p21, p22);
            Arc arc17 = fun.DrawArc4(p15, arc16.Radius, p21, 0);
            Arc arc18 = fun.DrawArc4(p15, arc15.Radius, p22, 0);
            Vector2 p23 = fun.Polar(p18, pi + pi / 4, pl);
            Vector2 v23 = fun.Polar(p23, pi / -2 - 0.1 * pi / 180, oal);
            Vector2 p24 = fun.Inters(p21, fun.Polar(p21, pi - pi / 4, oal), p23, v23);
            Vector2 p25 = fun.Inters(p22, fun.Polar(p22, pi - pi / 4, oal), p23, v23);
            Line line19 = new Line(p21, p24);
            Line line20 = new Line(p22, p25);
            Line line21 = new Line(p23, p25);
            Line line22 = new Line(p18, p23);
            Vector2 v26_ = fun.Polar(fun.Polar(p15, pi / 2, dconms / 10 * 8), pi, oal);
            Vector2 p26 = fun.Inters1(p15, v26_, arc17, 0);
            Arc arc19 = fun.DrawArc4(p26, arc17.Radius, p18, 0);
            Vector2 v27 = fun.Polar(p26, pi / -2 - 12 * pi / 180, oal);
            Vector2 p27 = fun.Inters(p16, fun.Polar(p16, pi, oal), p26, v27);
            Line line23 = new Line(p16, p27);
            Vector2 v27_1 = fun.Polar(p27, 166 * pi / 180, oal);
            Vector2 p28 = fun.Inters(p27, v27_1, p22, fun.Polar(p22, pi / -2, oal));
            Vector2 v28_1 = fun.Polar(p27, pi / -2, 0.01);
            Vector2 v28_2 = fun.Polar(v28_1, pi, oal);
            Line line24 = new Line(v28_1, v28_2);
            Arc arc20 = fun.DrawArc5(p28, line24, p27);
            Vector2 p29 = fun.Polar(p28, fun.CalAngle(p22, p25), fun.CalDistance(p22, p25));
            Line line25 = new Line(p25, p29);
            Line line26 = new Line(p29, p28);
            Vector2 p30 = fun.Polar(p1, 0, ls - 1);
            Vector2 p31 = fun.Polar(p30, pi / -4, Math.Sqrt(2));
            Vector2 p32 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p33 = fun.mirrorpoint(p31, p0_1, p0_2);
            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p30, p32, p33, p31, p30, p32, p2, p1);
            Vector2 p34 = fun.Polar(p29, pi, oal / 2.0);
            Vector2 p35 = fun.Polar(p34, pi / 2, dconms / 2.0);
            Vector2 p36 = fun.Polar(p35, pi / 2, dconms / 2.0);
            Vector2 p37 = fun.Polar(p35, pi, dconms);
            Vector2 p38 = fun.Polar(p36, pi, dconms);
            Vector2 p39 = fun.Polar(p38, -15 * pi / 180, dconms / 5.0 / Math.Cos(15 * pi / 180));
            Vector2 p40 = fun.Polar(p39, 15 * pi / 180, dconms / 5.0 / Math.Sin(75 * pi / 180));
            Vector2 p41 = fun.Polar(p40, -15 * pi / 180, dconms / 5.0 / Math.Cos(15 * pi / 180));
            Vector2 p42 = fun.Polar(p41, 15 * pi / 180, dconms / 5.0 / Math.Sin(75 * pi / 180));

            Vector2 p43 = fun.mirrorpoint(p35, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p36, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p38, p0_1, p0_2);
            Vector2 p47 = fun.mirrorpoint(p39, p0_1, p0_2);
            Vector2 p48 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p49 = fun.mirrorpoint(p41, p0_1, p0_2);
            Vector2 p50 = fun.mirrorpoint(p42, p0_1, p0_2);
            var polyline3 = Pus.AddPointsToLwPolyLine(p44, p43, p45, p46, p47, p48, p49, p50, p44);
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline3 .Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline3.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline3.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 135, 5, hline1, harc1, hatching);
            var polyline2 = Pus.AddPointsToLwPolyLine(p36, p35, p37, p38, p39, p40, p41, p42, p36);
            String[] htype2 = new String[100];
            Line[] hline2 = new Line[100];
            Arc[] harc2 = new Arc[100];
            int hnumst2 = polyline3.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype2[i] = polyline2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)polyline2.Explode()[i];
                }
                if (htype2[i] == "Arc")
                {
                    harc2[i] = (Arc)polyline2.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype2, hnumst2, 135, 5, hline2, harc2, hatching);
            dxf.AddEntity(new EntityObject[] {  arc1,arc2,arc3,arc4 ,arc5,arc6 ,arc8,arc9,arc10,arc11,arc12,arc13,arc14,arc17
                ,arc18,arc19,arc20
                ,line4,line5,line6,line9,line17,line19,line20,line21,line22,line23,line25 ,line26
                ,polyline1,polyline2,polyline3
            });
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);
            fun.drawBArc(dxf, arc10, 0.5, contour);
            fun.drawBArc(dxf, arc11, 0.5, contour);
            fun.drawBArc(dxf, arc12, 0.5, contour);
            fun.drawBArc(dxf, arc13, 0.5, contour);
            fun.drawBArc(dxf, arc14, 0.5, contour);
            fun.drawBArc(dxf, arc17, 0.5, contour);
            fun.drawBArc(dxf, arc18, 0.5, contour);
            fun.drawBArc(dxf, arc19, 0.5, contour);
            fun.drawBArc(dxf, arc20, 0.5, contour);
            fun.drawBline(dxf, line4, 0.5, contour);
            fun.drawBline(dxf, line5, 0.5, contour);
            fun.drawBline(dxf, line6, 0.5, contour);
            fun.drawBline(dxf, line9, 0.5, contour);
            fun.drawBline(dxf, line17, 0.5, contour);
            fun.drawBline(dxf, line19, 0.5, contour);
            fun.drawBline(dxf, line20, 0.5, contour);
            fun.drawBline(dxf, line21, 0.5, contour);
            fun.drawBline(dxf, line22, 0.5, contour);
            fun.drawBline(dxf, line23, 0.5, contour);
            fun.drawBline(dxf, line25, 0.5, contour);
            fun.drawBline(dxf, line26, 0.5, contour);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);


            //标注
            Vector2 o1_1 = fun.Polar(p23, 0, oal);
            Vector2 o1 = fun.Inters1(p23, o1_1, arc2, 0);
            Vector2 o2_1 = fun.Polar(p9, 0, 2.68 / 5.0 * (-(p9.X - p2.X)));
            Vector2 o2_2 = fun.Polar(o2_1, pi / 2, oal);
            Vector2 o2 = fun.Inters1(o2_1, o2_2, arc6, 0);
            Vector2 o3 = fun.Polar(p18, 0, lta);
            Vector2 o4 = fun.Polar(o3, pi / 2, dconms / 2.0);
            Vector2 o5 = fun.Polar(o4, pi / 4, dconms / 10.0);
            Vector2 o6 = fun.Polar(o5, 0, dconms / 6.0);
            Vector2 o7 = fun.mirrorpoint(o4, p0_1, p0_2);
            Vector2 o8 = fun.mirrorpoint(o5, p0_1, p0_2);
            Vector2 o9 = fun.mirrorpoint(o6, p0_1, p0_2);

            Vector2 o10 = fun.Polar(p24, pi / -3, 1.7);
            Vector2 o11 = fun.Polar(o10, pi / -3, dconms);
            Vector2 o12 = fun.Polar(o11, pi / -2, 1.2);

            Vector2 o13 = fun.Polar(p29, pi + pi / 4, 1.7);
            Vector2 o14 = fun.Polar(o13, pi + pi / 4, dconms);
            Vector2 o15 = fun.Polar(o14, pi / -2, 1.7 * 0.5);

            Vector2 o16 = fun.Polar(o3, pi / -2, dconms / 2.0);
            Vector2 o17 = fun.Polar(o16, pi / -4, dconms);
            Vector2 o18 = fun.Polar(o17, pi / -2, 1.2);

            Vector2 o19 = fun.Polar(p33, pi / 2, dconms / 2.0 - 1);
            Vector2 o20 = fun.Polar(o19, pi / -3, 1.7 * 0.5);
            Vector2 o21 = fun.Polar(o20, pi / -3, dconms);
            Vector2 o22 = fun.Polar(o21, pi / -2, 1.2);
            Vector2 o23 = fun.Polar(p15, pi / 2, dcintf * 3.5);
            Vector2 o24 = fun.Polar(p21, pi / -2, dconms*1.5);

            Line line27 = new Line(o4, o7);
            Line line28 = new Line(o4, o5);
            Line line29 = new Line(o5, o6);
            Line line31 = new Line(o4, o7);
            Line line32 = new Line(o7, o8);
            Line line33 = new Line(o8, o9);
            Line line30 = new Line(p0_1, p0_2);
            Line line34 = new Line(o10, o11);
            Line line35 = new Line(o13, o14);
            Line line36 = new Line(o16, o17);
            Line line37 = new Line(o20, o21);

          
            line30.Lineweight = Lineweight.W25;//Lineweight指线宽
            line30.Layer = center;//Layer指图层
            line30.LinetypeScale = 5;//指线性比例
            line30.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line30); //提取
           

            fun.dimrot1(dxf, p23, o1, 0, dcintf / 2, 2, 1.2, 1.6, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p23, o2, 0, dcintf * 1.3, 2, 1.2, 1.6, 0.9, "LCF", "", "");
            fun.dimrot1(dxf, p23, o3, 0, dcintf * 2, 2, 1.2, 1.6, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, p23, p31, 0, dcintf * 2.5, 2, 1.2, 1.6, 0.9, "OAL", "", "");
            fun.dimrot1(dxf, p2, p33, 180, dcintf, 2, 1.2, 1.6, 0.9, "LS", "", "");
            fun.dimrot1(dxf, p29, p28, 180, dcintf * 2 - (p28.Y - p29.Y) / 2.0 + (p33.Y - p28.Y) / 2.0, 2, 1.2, 1.6, 0.9, "PL", "", "");
            fun.dimrot1(dxf, p30, p33, -90, dcintf, 2, 1.2, 1.6, 0.9, "DMM", "", "");
            fun.dimrot1(dxf, p23, p25, 90, dcintf, 2, 1.2, 1.6, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p18, p27, 90, dcintf * 2, 2, 1.2, 1.6, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p45, p37, 90, 0.1, 2, 1.2, 1.6, 0.9, "PHD", "", "");

            fun.jdbz2(dxf, new Line(p29, fun.Polar(p29, fun.CalAngle(p28, p29), 0.1)), new Line(p23, fun.Polar(p23, fun.CalAngle(p18, p23), 0.1)), dcintf * 3, 1.6, 1.2, 0.9, "SIG", " ", " ");
            

            fun.Singlelinearrow(dxf, "LF", o24, 180, fun.Polar(o24, 0, dconms / 2.0), fun.Polar(o24, 0 , dconms), 1.2, 1.6);



            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            double scale = Convert.ToDouble(data["scale"]); //放大系数
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            // Line line1000 = new Line(p28, fun.Polar(p28, pi, oal));
            // dxf.AddEntity(line1000);


            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }


        public static void Flatbottomedcountersinkdrill1(Dictionary<string, Object> data)  //整体圆柱柄平底锪钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            /* double scale = 3;
             double pi = Math.PI;
             string path = Convert.ToString(data["path"]);
             double dc = 30;
             double dcintf = 18;
             double dconms = 24.5;
             double lcf = 34.277;
             double ls = 75.89;
             double oal = 34.277 * 5;
             double dn = 20;
             double fha = 10;
             double fha_ = fha * pi / 180;
            */

            double scale = Convert.ToDouble(data["scale"]); //放大系数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dc = Convert.ToDouble(data["dc"])*scale ; 
            double dcintf = Convert.ToDouble(data["dcintf"])*scale ;
            double dconms = Convert.ToDouble(data["dconms"])*scale ;
            double lcf = Convert.ToDouble(data["lcf"])*scale ;
            double ls = Convert.ToDouble(data["ls"])*scale ;
            double oal = Convert.ToDouble(data["oal"])*scale ;
            double dn = Convert.ToDouble(data["dn"])*scale ;
            double fha = Convert.ToDouble(data["fha"]);
            double fha_ = fha * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = new Vector2(-5, 0);
            Vector2 p0_2 = new Vector2(oal + 5, 0);
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 10.0 / 2.0);
            Vector2 p2 = fun.Polar(p0, pi / -2, dc / 10.0 / 2.0);
            Vector2 p3 = fun.Polar(p1, pi / 2, (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            Vector2 p4 = fun.Polar(p3, fha_, lcf / Math.Cos(fha_)+0.1);
            Vector2 p5 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p6 = fun.Polar(p4, pi / -2-0.01*pi/180, oal);
            Vector2 p7 = fun.Polar(p1, fha_, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            Vector2 p8 = fun.Polar(p1, pi / 2, (dcintf - (dc / 10.0)) / 2.0);
            Vector2 p9 = fun.Polar(p8, fha_, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0);
           /* System.Diagnostics.Debug.WriteLine((lcf-(dcintf -dc/10)/4.0) / Math.Cos(fha));
            System.Diagnostics.Debug.WriteLine((lcf - (dcintf - dc / 10) / 4.0));*/
          
           Vector2 p10 = fun.Polar(p7, pi / -2, dc / 10);
            Vector2 p11 = fun.mirrorpoint(p8, p0_1, p0_2);
            Vector2 p12 = fun.Polar(p11, fha_, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            Vector2 p13 = fun.Polar(p11, pi / -2, dc / 10.0);
            Vector2 p14 = fun.Polar(p12, pi / -2, dc / 10.0);
            Vector2 p15_ = fun.Polar(p0, pi / -2, dc / 2.0);
            Vector2 p15 = fun.Polar(p15_, 0, lcf / 20.0);
            Vector2 p16_1 = fun.Polar(p15, 0, oal);
            Vector2 p16_2 = fun.Polar(p14, pi / -2, oal);
            Vector2 p16 = fun.Inters(p15, p16_1, p14, p16_2);
            Vector2 p17 = fun.Polar(p8, pi / 2, dc / 10.0);
            Vector2 p18 = fun.Polar(p9, pi / 2, dc / 10.0);
            Vector2 p19 = fun.Polar(p18, pi , lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0-lcf /15.0);
            Vector2 p20 = fun.Polar(p16, pi / 6, (dc - dn));
            Vector2 p21 = fun.Polar(p18, pi / -6, (dc - dn));
            Vector2 p19_ = fun.Polar(p19, pi / -2, oal);
            Vector2 p22 = fun.Inters(p8, p9, p19, p19_ );
            Vector2 p23 = fun.Inters(p2, p10, p19, p19_);
            Vector2 p22_1 = fun.Polar(p19, 0, 0.1);
            Vector2 p22_2 = fun.Polar(p22_1, pi / -2+0.1*pi/180, oal);
            Vector2 p15_1 = fun.Polar(p15, 0, 0.1);
            Vector2 p15_2 = fun.Polar(p15_1, pi / 2 + 0.1 * pi / 180, oal);
            Vector2 p24_1 = fun.Polar(p3,fha_ ,lcf / Math.Cos(fha_));
            Vector2 p24_2 = fun.Polar(p24_1, pi / -2, oal);
            Vector2 p24 = fun.Inters(p16, p20, p24_1, p24_2);
            Line line1 = new Line(p22_1, p22_2);
            Line line2 = new Line(p15_1, p15_2);
            Line line3 = new Line(p4, p6);
            Vector2 p25 = fun.Polar(p20, 0, p21.X * 2);
            Vector2 p26 = fun.Polar (p21,0, p21.X * 2);
            Vector2 p25_1 = fun.Polar(p25, pi / 2, fun.CalDistance(p25, p26) / 2.0);
            Vector2 p25_2 = fun.Polar(p25_1, 0, oal);
            Vector2 p27 = fun.Polar(p25, pi / -4, (dconms - dn) / 2.0*Math.Sqrt  (2));
            Vector2 p28 = fun.mirrorpoint(p27, p25_1 , p25_2 );
            Vector2 p29=fun .Polar (p27,0,ls- (dconms - dn) / 2.0 * Math.Sqrt(2));
            Vector2 p30 = fun.mirrorpoint(p29, p25_1, p25_2);
            Vector2 p31 = fun.Polar(p29, pi / 4, (dconms - dn) / 2.0 * Math.Sqrt(2));
            Vector2 p32 = fun.mirrorpoint(p31, p25_1, p25_2);
            Vector2 p33 = fun.Polar(p0, pi, oal / 2.0);
            Vector2 p34 = fun.Polar(p33, pi / 2, dconms/2.0);
            Vector2 p35 = fun.Polar(p34, pi, dconms );
            Vector2 p36 = fun.Polar(p35, pi / 2, dconms / 2.0);
            Vector2 p37 = fun.Polar(p36, -15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p38 = fun.Polar(p37, 15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p39 = fun.Polar(p38, -15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p40 = fun.Polar(p39, 15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p41 = fun.Polar(p40, -15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p42 = fun.mirrorpoint(p34, p0_1, p0_2);
            Vector2 p43 = fun.mirrorpoint(p35, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p36, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p38, p0_1, p0_2);
            Vector2 p47 = fun.mirrorpoint(p39, p0_1, p0_2);
            Vector2 p48 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p49 = fun.mirrorpoint(p41, p0_1, p0_2);


            Arc arc1 = fun.DrawArc5(p17, line1, p19);
            Arc arc2 = fun.DrawArc5(p1, line1, p22);
            Arc arc3 = fun.DrawArc5(p11, line1, p23);
            Arc arc4 = fun.DrawArc5(p15, line2, p13);
            Arc arc5 = fun.DrawArc5(p7, line3, p9);
            Arc arc6 = fun.DrawArc5(p12, line3, p10);
            Arc arc7 = fun.DrawArc5(p24, line3, p14);
            var polyline1 = Pus.AddPointsToLwPolyLine(p19,p18,p17,p8,p9,p18,p21,p20,p16,p15);
            var polyline2 = Pus.AddPointsToLwPolyLine(p11, p13, p14, p12, p11);
            var polyline3 = Pus.AddPointsToLwPolyLine(p1, p2, p10, p7, p1);
            var polyline4 = Pus.AddPointsToLwPolyLine(p20, p25, p26, p28, p27, p25, p27, p29, p30, p32, p31, p29, p30, p28, p26, p21); ;
            var polyline5 = Pus.AddPointsToLwPolyLine(p34, p35, p36, p37, p38, p39, p40, p41,p34);
            var polyline6 = Pus.AddPointsToLwPolyLine(p42, p43, p44, p45, p46, p47, p48, p49,p42);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            fun.PolyFill(dxf, polyline5, 0.5, contour);
            fun.PolyFill(dxf, polyline6, 0.5, contour);

            //标注
            Vector2 v1 = fun.Polar(p32, pi / -2, p32.Y);
            Vector2 v2 = fun.Polar(p26, pi, ls / 8.0);
            Vector2 v3 = fun.Polar(v1, pi, ls / 2.0);
            Vector2 v4 = fun.Polar(p19, pi / 2 + 20 * pi / 180, dcintf * 3.5);

            Vector2 v5 = fun.Polar(p0, pi + pi / 4, 1.7*0.3*scale );
            Vector2 v6 = fun.Polar(v5, pi + pi / 4, dcintf*1.5);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);

            Vector2 v8 = fun.Polar(p13, pi / -2, -(p15.Y - p13.Y));

            Vector2 v9 = fun.Polar(v8, pi / -4, 1.7 * 0.3 * scale);
            Vector2 v10 = fun.Polar(v9, pi / -4, dcintf / 2.0);
            Vector2 v11 = fun.Polar(v10, pi / -2, 1.2 * scale);

            Vector2 v12 = fun.Polar(v3, pi + pi / 3, 1.7 * 0.3 * scale);
            Vector2 v13 = fun.Polar(v12, pi + pi / 3, dconms);
            Vector2 v14 = fun.Polar(v13, pi / -2, 1.2 * scale);

            Vector2 v15 = fun.Polar(v1, pi / -4, 1.7 * 0.3 * scale);
            Vector2 v16 = fun.Polar(v15, pi / -4, dconms);
            Vector2 v17 = fun.Polar(v16, pi / -2, 1.2 * scale);

            Vector2 v18 = fun.Polar(v3, pi / 2, dconms);
            Vector2 v19 = fun.Polar(v18, pi /4, dconms/4.0);
            Vector2 v20 = fun.Polar(v19, 0, dconms / 2.0);
            Vector2 v21 = fun.mirrorpoint(v18, fun.Polar(v3, 0, oal), v3);
            Vector2 v22 = fun.mirrorpoint(v19, fun.Polar(v3, 0, oal), v3);
            Vector2 v23= fun.mirrorpoint(v20, fun.Polar(v3, 0, oal), v3);
            Line linev5 = new Line(v18, v21);
            Line linev6 = new Line(v18, v19);
            Line linev7 = new Line(v19, v20);
            Line linev8 = new Line(v21, v22);
            Line linev9 = new Line(v22, v23);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            linev6.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev6.Layer = additionalline;//Layer指图层
            linev6.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev6.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev6); //提取
            linev7.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev7.Layer = additionalline;//Layer指图层
            linev7.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev7.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev7); //提取
            linev8.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev8.Layer = additionalline;//Layer指图层
            linev8.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev8.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev8); //提取
            linev9.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev9.Layer = additionalline;//Layer指图层
            linev9.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev9.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev9); //提取

            Line linev10 = new Line(p0_1, p0_2);
            linev10.Lineweight = Lineweight.W25;//Lineweight指线宽
            linev10.Layer = additionalline;//Layer指图层
            linev10.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev10.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev10); //提取

            fun.dimrot1(dxf, p0  ,p4 ,  0, dcintf+10 , 2, 1.2*scale , 1.6 * scale, 0.9, "LCF="+lcf/scale  , "", "");
            fun.dimrot1(dxf, p0, v2, 0, dcintf+20, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p0, v3, 0, dcintf+30, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR,LTA", "", "");
            fun.dimrot1(dxf, v1 ,p0, 0, dcintf+40, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL,LF="+oal/scale , "", "");
            fun.dimrot1(dxf, p29, p27, 180, dcintf*2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LS="+ls/scale , "", "");
            fun.dimrot1(dxf, p26, p25, 90, (p26.X - p21.X)/2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "DN="+dn/scale , "", "");
            fun.dimrot1(dxf, p30, p29, -90, dconms , 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS="+dconms /scale , "", "");
            fun.dimrot1(dxf, p8, p11, 90, dcintf , 2, 1.2 * scale, 1.6 * scale, 0.9, "DCINTF="+dcintf/scale , "", "");
            fun.dimrot1(dxf, p19, p15, 90, dcintf*1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC="+dc/scale , "", "");
            fun.dimrot1(dxf, p35, p43, -90, dcintf/2.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "PHD", "", "");

            fun.jdbz2(dxf, new Line (p0,fun .Polar (p0,pi/2,0.1)), new Line(p0, fun.Polar(p0, pi / -2 - 0.1 * pi / 180, 0.1)), dcintf*2.5 , 1.2 * scale, 1.6 * scale, 0.9, "SIG", "", "");
            fun.jdbz2(dxf, new Line(p2, fun.Polar(p2, 0, 0.1)), new Line(p2, p10),  dcintf*3 , 1.2 * scale, 1.6 * scale, 0.9, "FHA", "", "");
            fun.Singlelinearrow(dxf, "CCMS", p28, 80, fun.Polar(p28, 80 * pi / 180, dconms / 2.0), fun.Polar(p28, 80 * pi / 180, dconms), 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v4 , 180, fun.Polar(v4, 0 , dconms / 2.0), fun.Polar(v4, 0, dconms), 1.2 * scale, 1.6 * scale);
            fun.Axis(dxf, fun.Polar(p31, pi / -2, oal / 3.0), 0, -90, "Z", "X", "Y", 1, 1.2 * scale, 1);
            fun.Axis(dxf, v1 , 0, -90, "", "", "",0.3*scale  , 1.2 * scale, 1);
            fun.Axis(dxf,v3 , 0, -90, "", "", "", 0.3 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, p0 , 0, -90, "", "", "", 0.3 * scale, 1.2 * scale, 1);
            Line linev1 = new Line(v5, v6);
            Line linev2 = new Line(v9, v10);
            Line linev3 = new Line(v12, v13);
            Line line4 = new Line(v15, v16);
            Text txt1 = new Text("CIP", v7, 1.2*scale , 2);
            Text txt2 = new Text("CRP", v11, 1.2 * scale, 2);
            Text txt3 = new Text("MCS", v14, 1.2 * scale, 2);
            Text txt4 = new Text("PCS", v17, 1.2 * scale, 2);
           
            Circle circle1 = new Circle(Pus.ToV3(v8, 0), 1.7*0.3 * scale);
            dxf.AddEntity(new EntityObject[] { circle1, linev1, txt1, linev2, txt2, linev3, txt3,line4 ,txt4 });




            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);

            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ISYC_302_04(Dictionary<string, Object> data)  //整体圆柱柄平底锪钻
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            /*
            double scale = 3;
             double pi = Math.PI;
             string path = Convert.ToString(data["path"]);
             double dc = 30;
             double dcintf = 18;
             double dconms = 24.5;
             double lcf = 34.277;
             double ls = 75.89;
             double oal = 34.277 * 5;
             double dn = 20;
             double fha = 10;
             double fha_ = fha * pi / 180;
            */
            
            double scale = 3;
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dc = Convert.ToDouble(data["dc"]);
            double dcintf = Convert.ToDouble(data["dcintf"]);
            double dconms = Convert.ToDouble(data["dconms"]);
            double lcf = Convert.ToDouble(data["lcf"]);
            double ls = Convert.ToDouble(data["ls"]);
            double oal = Convert.ToDouble(data["oal"]);
            double dn = Convert.ToDouble(data["dn"]);
            double fha = Convert.ToDouble(data["fha"]);
            double fha_ = fha * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = new Vector2(-5, 0);
            Vector2 p0_2 = new Vector2(oal + 5, 0);
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 10.0 / 2.0);
            Vector2 p2 = fun.Polar(p0, pi / -2, dc / 10.0 / 2.0);
            Vector2 p3 = fun.Polar(p1, pi / 2, (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            Vector2 p4 = fun.Polar(p3, fha_, lcf / Math.Cos(fha_) + 0.1);
            Vector2 p5 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p6 = fun.Polar(p4, pi / -2 - 0.01 * pi / 180, oal);
            Vector2 p7 = fun.Polar(p1, fha_, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            Vector2 p8 = fun.Polar(p1, pi / 2, (dcintf - (dc / 10.0)) / 2.0);
            Vector2 p9 = fun.Polar(p8, fha_, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            /* System.Diagnostics.Debug.WriteLine((lcf-(dcintf -dc/10)/4.0) / Math.Cos(fha));
             System.Diagnostics.Debug.WriteLine((lcf - (dcintf - dc / 10) / 4.0));*/

            Vector2 p10 = fun.Polar(p7, pi / -2, dc / 10);
            Vector2 p11 = fun.mirrorpoint(p8, p0_1, p0_2);
            Vector2 p12 = fun.Polar(p11, fha_, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0);
            Vector2 p13 = fun.Polar(p11, pi / -2, dc / 10.0);
            Vector2 p14 = fun.Polar(p12, pi / -2, dc / 10.0);
            Vector2 p15_ = fun.Polar(p0, pi / -2, dc / 2.0);
            Vector2 p15 = fun.Polar(p15_, 0, lcf / 20.0);
            Vector2 p16_1 = fun.Polar(p15, 0, oal);
            Vector2 p16_2 = fun.Polar(p14, pi / -2, oal);
            Vector2 p16 = fun.Inters(p15, p16_1, p14, p16_2);
            Vector2 p17 = fun.Polar(p8, pi / 2, dc / 10.0);
            Vector2 p18 = fun.Polar(p9, pi / 2, dc / 10.0);
            Vector2 p19 = fun.Polar(p18, pi, lcf / Math.Cos(fha_) - (dcintf - (dc / 10.0)) / 2.0 / 2.0 - lcf / 15.0);
            Vector2 p20 = fun.Polar(p16, pi / 6, (dc - dn));
            Vector2 p21 = fun.Polar(p18, pi / -6, (dc - dn));
            Vector2 p19_ = fun.Polar(p19, pi / -2, oal);
            Vector2 p22 = fun.Inters(p8, p9, p19, p19_);
            Vector2 p23 = fun.Inters(p2, p10, p19, p19_);
            Vector2 p22_1 = fun.Polar(p19, 0, 0.1);
            Vector2 p22_2 = fun.Polar(p22_1, pi / -2 + 0.1 * pi / 180, oal);
            Vector2 p15_1 = fun.Polar(p15, 0, 0.1);
            Vector2 p15_2 = fun.Polar(p15_1, pi / 2 + 0.1 * pi / 180, oal);
            Vector2 p24_1 = fun.Polar(p3, fha_, lcf / Math.Cos(fha_));
            Vector2 p24_2 = fun.Polar(p24_1, pi / -2, oal);
            Vector2 p24 = fun.Inters(p16, p20, p24_1, p24_2);
            Line line1 = new Line(p22_1, p22_2);
            Line line2 = new Line(p15_1, p15_2);
            Line line3 = new Line(p4, p6);
            Vector2 p25 = fun.Polar(p20, 0, p21.X * 2);
            Vector2 p26 = fun.Polar(p21, 0, p21.X * 2);
            Vector2 p25_1 = fun.Polar(p25, pi / 2, fun.CalDistance(p25, p26) / 2.0);
            Vector2 p25_2 = fun.Polar(p25_1, 0, oal);
            Vector2 p27 = fun.Polar(p25, pi / -4, (dconms - dn) / 2.0 * Math.Sqrt(2));
            Vector2 p28 = fun.mirrorpoint(p27, p25_1, p25_2);
            Vector2 p29 = fun.Polar(p27, 0, ls - (dconms - dn) / 2.0 * Math.Sqrt(2));
            Vector2 p30 = fun.mirrorpoint(p29, p25_1, p25_2);
            Vector2 p31 = fun.Polar(p29, pi / 4, (dconms - dn) / 2.0 * Math.Sqrt(2));
            Vector2 p32 = fun.mirrorpoint(p31, p25_1, p25_2);
            Vector2 p33 = fun.Polar(p0, pi, oal / 2.0);
            Vector2 p34 = fun.Polar(p33, pi / 2, dconms / 2.0);
            Vector2 p35 = fun.Polar(p34, pi, dconms);
            Vector2 p36 = fun.Polar(p35, pi / 2, dconms / 2.0);
            Vector2 p37 = fun.Polar(p36, -15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p38 = fun.Polar(p37, 15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p39 = fun.Polar(p38, -15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p40 = fun.Polar(p39, 15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p41 = fun.Polar(p40, -15 * pi / 180, dconms / 5.0 / Math.Cos(-15 * pi / 180));
            Vector2 p42 = fun.mirrorpoint(p34, p0_1, p0_2);
            Vector2 p43 = fun.mirrorpoint(p35, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p36, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p38, p0_1, p0_2);
            Vector2 p47 = fun.mirrorpoint(p39, p0_1, p0_2);
            Vector2 p48 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p49 = fun.mirrorpoint(p41, p0_1, p0_2);


            Arc arc1 = fun.DrawArc5(p17, line1, p19);
            Arc arc2 = fun.DrawArc5(p1, line1, p22);
            Arc arc3 = fun.DrawArc5(p11, line1, p23);
            Arc arc4 = fun.DrawArc5(p15, line2, p13);
            Arc arc5 = fun.DrawArc5(p7, line3, p9);
            Arc arc6 = fun.DrawArc5(p12, line3, p10);
            Arc arc7 = fun.DrawArc5(p24, line3, p14);
            var polyline1 = Pus.AddPointsToLwPolyLine(p19, p18, p17, p8, p9, p18, p21, p20, p16, p15);
            var polyline2 = Pus.AddPointsToLwPolyLine(p11, p13, p14, p12, p11);
            var polyline3 = Pus.AddPointsToLwPolyLine(p1, p2, p10, p7, p1);
            var polyline4 = Pus.AddPointsToLwPolyLine(p20, p25, p26, p28, p27, p25, p27, p29, p30, p32, p31, p29, p30, p28, p26, p21); ;
            var polyline5 = Pus.AddPointsToLwPolyLine(p34, p35, p36, p37, p38, p39, p40, p41, p34);
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline5.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline5.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline5.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline5.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 135, 5, hline1, harc1, hatching);
            var polyline6 = Pus.AddPointsToLwPolyLine(p42, p43, p44, p45, p46, p47, p48, p49, p42);
            String[] htype2 = new String[100];
            Line[] hline2 = new Line[100];
            Arc[] harc2 = new Arc[100];
            int hnumst2 = polyline6.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype2[i] = polyline6.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)polyline6.Explode()[i];
                }
                if (htype2[i] == "Arc")
                {
                    harc2[i] = (Arc)polyline6.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype2, hnumst2, 135, 5, hline2, harc2, hatching);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            fun.PolyFill(dxf, polyline5, 0.5, contour);
            fun.PolyFill(dxf, polyline6, 0.5, contour);

            //标注
            Vector2 v1 = fun.Polar(p32, pi / -2, p32.Y);
            Vector2 v2 = fun.Polar(p26, pi, ls / 8.0);
            Vector2 v3 = fun.Polar(v1, pi, ls / 2.0);
            Vector2 v4 = fun.Polar(p19, pi / 2 + 20 * pi / 180, dcintf * 3.5);

            Vector2 v5 = fun.Polar(p0, pi + pi / 4, 1.7 * 0.3 * scale);
            Vector2 v6 = fun.Polar(v5, pi + pi / 4, dcintf * 1.5);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);

            Vector2 v8 = fun.Polar(p13, pi / -2, -(p15.Y - p13.Y));

            Vector2 v9 = fun.Polar(v8, pi / -4, 1.7 * 0.3 * scale);
            Vector2 v10 = fun.Polar(v9, pi / -4, dcintf / 2.0);
            Vector2 v11 = fun.Polar(v10, pi / -2, 1.2 * scale);

            Vector2 v12 = fun.Polar(v3, pi + pi / 3, 1.7 * 0.3 * scale);
            Vector2 v13 = fun.Polar(v12, pi + pi / 3, dconms);
            Vector2 v14 = fun.Polar(v13, pi / -2, 1.2 * scale);

            Vector2 v15 = fun.Polar(v1, pi / -4, 1.7 * 0.3 * scale);
            Vector2 v16 = fun.Polar(v15, pi / -4, dconms);
            Vector2 v17 = fun.Polar(v16, pi / -2, 1.2 * scale);
                                                                
            Vector2 v18 = fun.Polar(v3, pi / 2, dconms);
            Vector2 v19 = fun.Polar(v18, pi / 4, dconms / 4.0);
            Vector2 v20 = fun.Polar(v19, 0, dconms / 2.0);
            Vector2 v21 = fun.mirrorpoint(v18, fun.Polar(v3, 0, oal), v3);
            Vector2 v22 = fun.mirrorpoint(v19, fun.Polar(v3, 0, oal), v3);
            Vector2 v23 = fun.mirrorpoint(v20, fun.Polar(v3, 0, oal), v3);

            Vector2 v24 = fun.Polar(p13, pi / -2, dconms);
            Line linev5 = new Line(v18, v21);
            Line linev6 = new Line(v18, v19);
            Line linev7 = new Line(v19, v20);
            Line linev8 = new Line(v21, v22);
            Line linev9 = new Line(v22, v23);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            linev6.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev6.Layer = additionalline;//Layer指图层
            linev6.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev6.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev6); //提取
            linev7.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev7.Layer = additionalline;//Layer指图层
            linev7.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev7.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev7); //提取
            linev8.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev8.Layer = additionalline;//Layer指图层
            linev8.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev8.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev8); //提取
            linev9.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev9.Layer = additionalline;//Layer指图层
            linev9.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev9.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev9); //提取

            Line linev10 = new Line(p0_1, p0_2);
            linev10.Lineweight = Lineweight.W25;//Lineweight指线宽
            linev10.Layer = centre ;//Layer指图层
            linev10.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev10.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev10); //提取

            fun.dimrot1(dxf, p0, p4, 0, dcintf * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF", "", "");
            fun.dimrot1(dxf, p0, v2, 0, dcintf * 2.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p0, v3, 0, dcintf * 3.3, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, v1, p0, 0, dcintf * 3.8, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL", "", "");
            fun.dimrot1(dxf, p29, p27, 180, dcintf * 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LS", "", "");
           // fun.dimrot1(dxf, p26, p25, 90, (p26.X - p21.X) / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "DN", "", "");
            fun.dimrot1(dxf, p30, p29, -90, dconms, 2, 1.2 * scale, 1.6 * scale, 0.9, "DMM", "", "");
            fun.dimrot1(dxf, p8, p11, 90, dcintf, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p19, p15, 90, dcintf * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p35, p43, -90, dcintf / 2.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "PHD", "", "");
            fun.Singlelinearrow(dxf, "LF", v24 ,180, fun.Polar(v24 , 0, dconms / 2.0), fun.Polar(v24, 0, dconms), 1.2 * scale, 1.6 * scale);
            fun.jdbz2(dxf, new Line(p0, fun.Polar(p0, pi / 2, 0.1)), new Line(p0, fun.Polar(p0, pi / -2 - 0.1 * pi / 180, 0.1)), dcintf * 2.5, 1.2 * scale, 1.6 * scale, 0.9, "SIG", "", "");
            /*fun.jdbz2(dxf, new Line(p2, fun.Polar(p2, 0, 0.1)), new Line(p2, p10), dcintf * 3, 1.2 * scale, 1.6 * scale, 0.9, "FHA", "", "");
            fun.Singlelinearrow(dxf, "CCMS", p28, 80, fun.Polar(p28, 80 * pi / 180, dconms / 2.0), fun.Polar(p28, 80 * pi / 180, dconms), 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v4, 180, fun.Polar(v4, 0, dconms / 2.0), fun.Polar(v4, 0, dconms), 1.2 * scale, 1.6 * scale);
            fun.Axis(dxf, fun.Polar(p31, pi / -2, oal / 3.0), 0, -90, "Z", "X", "Y", 1, 1.2 * scale, 1);
            fun.Axis(dxf, v1, 0, -90, "", "", "", 0.3 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, v3, 0, -90, "", "", "", 0.3 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, p0, 0, -90, "", "", "", 0.3 * scale, 1.2 * scale, 1);
            Line linev1 = new Line(v5, v6);
            Line linev2 = new Line(v9, v10);
            Line linev3 = new Line(v12, v13);
            Line line4 = new Line(v15, v16);
            Text txt1 = new Text("CIP", v7, 1.2 * scale, 2);
            Text txt2 = new Text("CRP", v11, 1.2 * scale, 2);
            Text txt3 = new Text("MCS", v14, 1.2 * scale, 2);
            Text txt4 = new Text("PCS", v17, 1.2 * scale, 2);

            Circle circle1 = new Circle(Pus.ToV3(v8, 0), 1.7 * 0.3 * scale);
            dxf.AddEntity(new EntityObject[] { circle1, linev1, txt1, linev2, txt2, linev3, txt3, line4, txt4 });*/

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Cylindricalconicalspotfacer1(Dictionary<string, Object> data)  //整体圆柱柄锥面锪钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            /*
            double sl_ = 160;
            double scale = 1;

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 3;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dc = 20* scale;
            double dcx = 40 * scale;
            double tpl = 32.68 * scale;
            double dconms = 24 * scale;
            double lcf = 40 * scale;
            double ls = 60 * scale;
            double oal = 160 * scale;
            double ta = 30;
            double ta_ = ta * pi / 180;
            */

            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 3;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }

            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double tpl = Convert.ToDouble(data["tpl"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double ls = Convert.ToDouble(data["ls"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double ta = Convert.ToDouble(data["ta"]);
            double ta_ = ta * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Polar(p1, ta_, tpl / Math.Cos(ta_));
            Vector2 p4 = fun.Polar(p3, 0, (lcf - tpl) / 2.0);
            Vector2 p5 = fun.Polar(p4, pi / -4, Math.Sqrt(2) * ((lcf - tpl) / 2.0));
            Vector2 p6 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p7 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p5, p0_1, p0_2);
            Line line1 = new Line(p3, p4);
            Line line2 = new Line(p6, p7);
            Vector2 p9_ = fun.Polar(p1, ta_ / 2.0, oal);
            Vector2 p9 = fun.Inters(p1, p9_, p3, p6);
            Vector2 p10_ = fun.Polar(p9, 0, oal);
            Vector2 p10 = fun.Inters(p9, p10_, p4, p7);
            Vector2 p11_ = fun.Polar(p10, -ta_ / 2.0, oal);
            Vector2 p11 = fun.Inters(p10, p11_, p5, p8);
            Vector2 p12 = fun.Inters(p0, p0_2, p3, p6);
            Vector2 p13_ = fun.Polar(p12, ta_ / 4, oal);
            Vector2 p13 = fun.Inters(p12, p13_, p4, p7);
            Vector2 p14_ = fun.Polar(p13, pi / 4, oal);
            Vector2 p14 = fun.Inters(p13, p14_, p5, p8);
            Vector2 p15 = fun.Polar(p0, pi / 2, fun.CalDistance(p1, p0) / 2.0);
            Vector2 p16_ = fun.Polar(p15, ta_ / 4, oal);
            Vector2 p16 = fun.Inters(p16_, p15, p5, p8);
            Vector2 p17 = fun.Inters(p0, p0_2, p5, p8);
            Vector2 p18 = fun.Polar(p17, pi / 2, dc/2.0);
            Vector2 p19 = fun.Polar(p17, pi / -2, dc / 2.0);

            Vector2 p20 = fun.Polar(p18, 0, (oal - lcf - ls - (dconms - dc) / 2.0));
            Vector2 p21 = fun.Polar(p20,pi/4, (dconms - dc) / 2.0);
            Vector2 p22 = fun.Polar(p21, 0, ls - (dconms - dc) / 2.0);
            Vector2 p23 = fun.Polar(p22, pi / -4, (dconms - dc) / 2.0);
            Vector2 p24 = fun.mirrorpoint(p20, p0_1, p0_2);
            Vector2 p25 = fun.mirrorpoint(p21, p0_1, p0_2);
            Vector2 p26 = fun.mirrorpoint(p22, p0_1, p0_2);
            Vector2 p27 = fun.mirrorpoint(p23, p0_1, p0_2);

            Vector2 p28 = fun.Polar(p0, pi, dconms * 2.5);
            Vector2 p29 = fun.Polar(p28, pi / 2, dconms/2.0);
            Vector2 p30 = fun.Polar(p29, pi, dconms);
            Vector2 p31 = fun.Polar(p30, pi / 2, dconms / 2.0);
            Vector2 p32 = fun.Polar(p31, 15 * pi / 180, (dconms / 5.0) / Math.Cos(15 *pi / 180));
            Vector2 p33 = fun.Polar(p32, -15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p34 = fun.Polar(p33, 15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p35 = fun.Polar(p34, -15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p36 = fun.Polar(p35, 15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p37 = fun.mirrorpoint(p29, p0_1, p0_2);
            Vector2 p38 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p39 = fun.mirrorpoint(p31, p0_1, p0_2);
            Vector2 p40 = fun.mirrorpoint(p32, p0_1, p0_2);
            Vector2 p41 = fun.mirrorpoint(p33, p0_1, p0_2);
            Vector2 p42 = fun.mirrorpoint(p34, p0_1, p0_2);
            Vector2 p43 = fun.mirrorpoint(p35, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p36, p0_1, p0_2);

            var polyline1 = Pus.AddPointsToLwPolyLine(p0,p1,p3,p4,p5,p8,p7,p6,p2,p0,
                p12,p13,p7,p6,p12,p13,p14,p16,p15,p1,p9,p10,p4,p3,p9,p10,p11);            
            var polyline2 = Pus.AddPointsToLwPolyLine(p18, p20, p21, p25, p24, p20, p21, p22, p23, p27, p26, p22, p26, p25, p24, p19);           
            var polyline3 = Pus.AddPointsToLwPolyLine(p29, p30, p31, p32, p33, p34, p35, p36,p29 );
            var polyline4 = Pus.AddPointsToLwPolyLine(p37, p38, p39, p40, p41, p42, p43, p44,p37 );
           // dxf.AddEntity(new EntityObject[] { polyline1, polyline2, polyline3, polyline4 });
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);

            //标注
            Vector2 v1 = fun.Polar(p27, pi / 2, p23.Y);
            Vector2 v2 = fun.Polar(fun.Polar(p21, 0, oal / 8), pi / -2, dconms  / 2.0);
            Vector2 v3 = fun.Polar(p21, 0, oal / 7);
            Vector2 v4 = fun.Polar(p1, pi - pi/4, dconms * 3);

            Vector2 v5 = fun.Polar(p0 , pi+pi / 4, 1 * 1.7 * scale);
            Vector2 v6 = fun.Polar(v5, pi+pi / 4, dconms);
            Vector2 v7 = fun.Polar(v6, pi / -2, 3.6 * scale);

            Vector2 v8 = fun.Polar(p2 ,pi+ pi / 3, 1*1.7*scale );
            Vector2 v9 = fun.Polar(v8,pi+pi / 3, dconms);
            Vector2 v10 = fun.Polar(v9, pi / -2, 3.6 * scale);

            Vector2 v11 = fun.Polar(v2, pi + pi / 3, 1 * 1.7 * scale);
            Vector2 v12 = fun.Polar(v11, pi + pi / 3, dconms);
            Vector2 v13 = fun.Polar(v12, pi / -2, 3.6 * scale);

            Vector2 v14 = fun.Polar(v1, pi / -4, 1 * 1.7 * scale);
            Vector2 v15 = fun.Polar(v14, pi / -4, dconms);
            Vector2 v16 = fun.Polar(v15, pi / -2, 3.6 * scale);

            Vector2 v17 = fun.Polar(p21, pi / 2, dconms * 4.8);

            Vector2 v18 = fun.Polar(v2, pi / 2, dconms );
            Vector2 v19 = fun.Polar(v18, pi / 4, dconms / 4.0);
            Vector2 v20 = fun.Polar(v19, 0, dconms / 2.0);
            Vector2 v21 = fun.mirrorpoint(v18, p0_1, p0_2);
            Vector2 v22 = fun.mirrorpoint(v19, p0_1, p0_2);
            Vector2 v23 = fun.mirrorpoint(v20, p0_1, p0_2);
            Line linev5 = new Line(v18, v21);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            Line linev6 = new Line(v18, v19);
            linev6.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev6.Layer = additionalline;//Layer指图层
            linev6.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev6.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev6); //提取
            Line linev7 = new Line(v19, v20);
            linev7.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev7.Layer = additionalline;//Layer指图层
            linev7.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev7.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev7); //提取
            Line linev8 = new Line(v22, v23);
            linev8.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev8.Layer = additionalline;//Layer指图层
            linev8.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev8.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev8); //提取
            Line linev9 = new Line(v22, v21);
            linev9.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev9.Layer = additionalline;//Layer指图层
            linev9.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev9.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev9); //提取

            Line linev10 = new Line(p0_1, p0_2);
            linev10.Lineweight = Lineweight.W25;//Lineweight指线宽
            linev10.Layer = additionalline;//Layer指图层
            linev10.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev10.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev10); //提取

            fun.dimrot1(dxf, p1, p2 ,  90, dconms , 2, 3.6 * scale, 4.8 * scale, 0.9, "DC="+dc/scale , " ", " ");
            fun.dimrot1(dxf, p3, p6, 90, (dconms+(p6.X -p2.X ))*1.2  , 2, 3.6 * scale, 4.8 * scale, 0.9, "DCX", " ", " ");
            fun.dimrot1(dxf, p3, p1,  0, dconms+10, 2, 3.6 * scale, 4.8 * scale, 0.9, "TPL="+tpl/scale , " ", " ");
            fun.dimrot1(dxf, p1, p5,  0, dconms+20  , 2, 3.6 * scale, 4.8 * scale, 0.9, "LCF,LH="+lcf/scale , " ", " ");
            fun.dimrot1(dxf, p1, fun .Polar (p20,pi,oal/20), 0, dconms+30, 2, 3.6 * scale, 4.8 * scale, 0.9, "LU", " ", " ");
            fun.dimrot1(dxf, p1, fun .Polar (v2,pi/2,dconms /2.0), 0, dconms +40, 2, 3.6 * scale, 4.8 * scale, 0.9, "LPR,LTA", " ", " ");
            fun.dimrot1(dxf, p0, v1, 0, dconms * 4.8, 2, 3.6 * scale, 4.8 * scale, 0.9, "OAL,LF="+oal/scale , " ", " ");
            fun.dimrot1(dxf, p23, p27, -90, dconms, 2, 3.6 * scale, 4.8 * scale, 0.9, "DCONMS="+dconms/scale , " ", " ");
            fun.dimrot1(dxf, p25, p27, 180, dconms*1.5 , 2, 3.6 * scale, 4.8 * scale, 0.9, "LS="+ls/scale , " ", " ");
            fun.dimrot1(dxf, p29, p37, 90, dconms /5.0, 2, 3.6 * scale, 4.8 * scale, 0.9, "PHD", " ", " ");
            fun.jdbz2(dxf, new Line (p2,p6 ), new Line (p1,p3 ), dconms*3 , 3.6 * scale, 4.8 * scale, 0.9, "TA", " ", " ");
            fun.Axis(dxf, fun.Polar(p27, pi / -3, dconms * 2.5), 0, -90, "Z", "X", "Y", 1*scale , 3.6 * scale, 1);
            fun.Axis(dxf, v1 , 0, -90, " ", " ", " ", 1*scale , 3.6 * scale, 1);
            fun.Axis(dxf, v2, 0, -90, " ", " ", " ", 1*scale , 3.6 * scale, 1);
            fun.Axis(dxf, p0, 0, -90, " ", " ", " ", 1 * scale, 3.6 * scale, 1);
            fun.Singlelinearrow(dxf, "CCMS", v3 , 60, fun.Polar(v3, pi / 3, dconms / 2.0), fun.Polar(v3 , pi / 3, dconms), 3.6 * scale, 4.8 * scale);
            fun.Singlelinearrow(dxf, "FDP", v4 , 180, fun.Polar(v4, 0, dconms / 2.0), fun.Polar(v4, 0, dconms), 3.6 * scale, 4.8 * scale);
            Line linev1 = new Line(v5, v6);
            Text txt1= new Text("CIP", v7, 3.6*scale , 2);
            Line linev2 = new Line(v8, v9);
            Text txt2 = new Text("CRP", v10, 3.6 * scale, 2);
            Line linev3 = new Line(v11, v12);
            Text txt3 = new Text("MCS", v13, 3.6 * scale, 2);
            Line linev4 = new Line(v14, v15);
            Text txt4 = new Text("PCS", v16, 3.6 * scale, 2);
            Text txt5 = new Text("ISYC=302_05", v17, 3.6 * scale, 2);
            Circle circle1 = new Circle(Pus .ToV3  (p2,0) , 1*1.7*scale );
            dxf.AddEntity(new EntityObject[] { linev1, linev2, linev3, linev4, txt1, txt2, txt3, txt4,txt5, circle1 });
            // System.Diagnostics.Debug.WriteLine(tpl );



            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        public static void ISYC_302_05(Dictionary<string, Object> data)  //整体圆柱柄锥面锪钻
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            /*
            double sl_ = 160;
            double scale = 1;

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 3;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dc = 20* scale;
            double dcx = 40 * scale;
            double tpl = 32.68 * scale;
            double dconms = 24 * scale;
            double lcf = 40 * scale;
            double ls = 60 * scale;
            double oal = 160 * scale;
            double ta = 30;
            double ta_ = ta * pi / 180;
            */
            
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 3;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double tpl = Convert.ToDouble(data["tpl"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double ls = Convert.ToDouble(data["ls"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double ta = Convert.ToDouble(data["ta"]);
            double ta_ = ta * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Polar(p1, ta_, tpl / Math.Cos(ta_));
            Vector2 p4 = fun.Polar(p3, 0, (lcf - tpl) / 2.0);
            Vector2 p5 = fun.Polar(p4, pi / -4, Math.Sqrt(2) * ((lcf - tpl) / 2.0));
            Vector2 p6 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p7 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p5, p0_1, p0_2);
            Line line1 = new Line(p3, p4);
            Line line2 = new Line(p6, p7);
            Vector2 p9_ = fun.Polar(p1, ta_ / 2.0, oal);
            Vector2 p9 = fun.Inters(p1, p9_, p3, p6);
            Vector2 p10_ = fun.Polar(p9, 0, oal);
            Vector2 p10 = fun.Inters(p9, p10_, p4, p7);
            Vector2 p11_ = fun.Polar(p10, -ta_ / 2.0, oal);
            Vector2 p11 = fun.Inters(p10, p11_, p5, p8);
            Vector2 p12 = fun.Inters(p0, p0_2, p3, p6);
            Vector2 p13_ = fun.Polar(p12, ta_ / 4, oal);
            Vector2 p13 = fun.Inters(p12, p13_, p4, p7);
            Vector2 p14_ = fun.Polar(p13, pi / 4, oal);
            Vector2 p14 = fun.Inters(p13, p14_, p5, p8);
            Vector2 p15 = fun.Polar(p0, pi / 2, fun.CalDistance(p1, p0) / 2.0);
            Vector2 p16_ = fun.Polar(p15, ta_ / 4, oal);
            Vector2 p16 = fun.Inters(p16_, p15, p5, p8);
            Vector2 p17 = fun.Inters(p0, p0_2, p5, p8);
            Vector2 p18 = fun.Polar(p17, pi / 2, dc / 2.0);
            Vector2 p19 = fun.Polar(p17, pi / -2, dc / 2.0);

            Vector2 p20 = fun.Polar(p18, 0, (oal - lcf - ls - (dconms - dc) / 2.0));
            Vector2 p21 = fun.Polar(p20, pi / 4, (dconms - dc) / 2.0);
            Vector2 p22 = fun.Polar(p21, 0, ls - (dconms - dc) / 2.0);
            Vector2 p23 = fun.Polar(p22, pi / -4, (dconms - dc) / 2.0);
            Vector2 p24 = fun.mirrorpoint(p20, p0_1, p0_2);
            Vector2 p25 = fun.mirrorpoint(p21, p0_1, p0_2);
            Vector2 p26 = fun.mirrorpoint(p22, p0_1, p0_2);
            Vector2 p27 = fun.mirrorpoint(p23, p0_1, p0_2);

            Vector2 p28 = fun.Polar(p0, pi, dconms * 2.5);
            Vector2 p29 = fun.Polar(p28, pi / 2, dconms / 2.0);
            Vector2 p30 = fun.Polar(p29, pi, dconms);
            Vector2 p31 = fun.Polar(p30, pi / 2, dconms / 2.0);
            Vector2 p32 = fun.Polar(p31, 15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p33 = fun.Polar(p32, -15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p34 = fun.Polar(p33, 15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p35 = fun.Polar(p34, -15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p36 = fun.Polar(p35, 15 * pi / 180, (dconms / 5.0) / Math.Cos(15 * pi / 180));
            Vector2 p37 = fun.mirrorpoint(p29, p0_1, p0_2);
            Vector2 p38 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p39 = fun.mirrorpoint(p31, p0_1, p0_2);
            Vector2 p40 = fun.mirrorpoint(p32, p0_1, p0_2);
            Vector2 p41 = fun.mirrorpoint(p33, p0_1, p0_2);
            Vector2 p42 = fun.mirrorpoint(p34, p0_1, p0_2);
            Vector2 p43 = fun.mirrorpoint(p35, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p36, p0_1, p0_2);

            var polyline1 = Pus.AddPointsToLwPolyLine(p0, p1, p3, p4, p5, p8, p7, p6, p2, p0,
                p12, p13, p7, p6, p12, p13, p14, p16, p15, p1, p9, p10, p4, p3, p9, p10, p11);
            var polyline2 = Pus.AddPointsToLwPolyLine(p18, p20, p21, p25, p24, p20, p21, p22, p23, p27, p26, p22, p26, p25, p24, p19);
            var polyline3 = Pus.AddPointsToLwPolyLine(p29, p30, p31, p32, p33, p34, p35, p36, p29);
            var polyline4 = Pus.AddPointsToLwPolyLine(p37, p38, p39, p40, p41, p42, p43, p44, p37);
           // dxf.AddEntity(new EntityObject[] { polyline1, polyline2, polyline3, polyline4 });
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline3.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline3.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline3.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 135, 5, hline1, harc1, hatching);    
            String[] htype2 = new String[100];
            Line[] hline2 = new Line[100];
            Arc[] harc2 = new Arc[100];
            int hnumst2 = polyline4.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype2[i] = polyline4.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)polyline4.Explode()[i];
                }
                if (htype2[i] == "Arc")
                {
                    harc2[i] = (Arc)polyline4.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype2, hnumst2, 135, 5, hline2, harc2, hatching);
            //标注
            Vector2 v1 = fun.Polar(p27, pi / 2, p23.Y);
            Vector2 v2 = fun.Polar(fun.Polar(p21, 0, oal / 8), pi / -2, dconms / 2.0);
            Vector2 v3 = fun.Polar(p21, 0, oal / 7);
            Vector2 v4 = fun.Polar(p1, pi - pi / 4, dconms * 3);

            Vector2 v5 = fun.Polar(p0, pi + pi / 4, 1 * 1.7 * scale);
            Vector2 v6 = fun.Polar(v5, pi + pi / 4, dconms);
            Vector2 v7 = fun.Polar(v6, pi / -2, 3.6 * scale);

            Vector2 v8 = fun.Polar(p2, pi + pi / 3, 1 * 1.7 * scale);
            Vector2 v9 = fun.Polar(v8, pi + pi / 3, dconms);
            Vector2 v10 = fun.Polar(v9, pi / -2, 3.6 * scale);

            Vector2 v11 = fun.Polar(v2, pi + pi / 3, 1 * 1.7 * scale);
            Vector2 v12 = fun.Polar(v11, pi + pi / 3, dconms);
            Vector2 v13 = fun.Polar(v12, pi / -2, 3.6 * scale);

            Vector2 v14 = fun.Polar(v1, pi / -4, 1 * 1.7 * scale);
            Vector2 v15 = fun.Polar(v14, pi / -4, dconms);
            Vector2 v16 = fun.Polar(v15, pi / -2, 3.6 * scale);

            Vector2 v17 = fun.Polar(p21, pi / 2, dconms * 4.8);
            Vector2 v18 = fun.Polar(v2, pi / 2, dconms);
            Vector2 v19 = fun.Polar(v18, pi / 4, dconms / 4.0);
            Vector2 v20 = fun.Polar(v19, 0, dconms / 2.0);
            Vector2 v21 = fun.mirrorpoint(v18, p0_1, p0_2);
            Vector2 v22 = fun.mirrorpoint(v19, p0_1, p0_2);
            Vector2 v23 = fun.mirrorpoint(v20, p0_1, p0_2);

            Vector2 v24 = fun.Polar(p1, pi / 2, (dconms + (p6.X - p2.X)) * 1.2);
            Vector2 v25 = fun.Polar(v24, pi / -2, 5*scale );
            Line linev10 = new Line(p1, v24);
            dxf.AddEntity(linev10);
            fun.Singlelinearrow(dxf, "LF", v25 , 180, fun.Polar(v25, 0, dconms / 2.0), fun.Polar(v25, 0, dconms), 3.6 * scale, 4.8 * scale);


            Line linev5 = new Line(v18, v21);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            Line linev6 = new Line(v18, v19);
            linev6.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev6.Layer = additionalline;//Layer指图层
            linev6.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev6.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev6); //提取
            Line linev7 = new Line(v19, v20);
            linev7.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev7.Layer = additionalline;//Layer指图层
            linev7.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev7.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev7); //提取
            Line linev8 = new Line(v22, v23);
            linev8.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev8.Layer = additionalline;//Layer指图层
            linev8.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev8.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev8); //提取
            Line linev9 = new Line(v22, v21);
            linev9.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev9.Layer = additionalline;//Layer指图层
            linev9.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev9.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev9); //提取

            Line linev11 = new Line(p0_1, p0_2);
            linev11.Lineweight = Lineweight.W25;//Lineweight指线宽
            linev11.Layer = additionalline;//Layer指图层
            linev11.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev11.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev11); //提取

            fun.dimrot1(dxf, p1, p2, 90, dconms, 2, 3.6 * scale, 4.8 * scale, 0.9, "DC_1", " ", " ");
            fun.dimrot1(dxf, p1, p4, 0, (dconms + (p6.X - p2.X))/2.0 , 2, 3.6 * scale , 4.8 * scale, 1.2 *scale , "LCF", " ", " ");
            fun.dimrot1(dxf, p3, p6, 90, (dconms + (p6.X - p2.X))*1.3, 2, 3.6 * scale, 4.8 * scale, 1.2 * scale, "DC_2", " ", " ");
            // fun.dimrot1(dxf, p1, fun.Polar(p20, pi, oal / 20), 0, dconms * 2.4, 2, 3.6 * scale, 4.8 * scale, 0.9, "LU", " ", " ");
            // fun.dimrot1(dxf, p1, fun.Polar(v2, pi / 2, dconms / 2.0), 0, dconms * 3.6, 2, 3.6 * scale, 4.8 * scale, 0.9, "LPR", " ", " ");
            // fun.dimrot1(dxf, p0, v1, 0, dconms * 4.8, 2, 3.6 * scale, 4.8 * scale, 0.9, "OAL", " ", " ");
            // fun.dimrot1(dxf, p23, p27, -90, dconms, 2, 3.6 * scale, 4.8 * scale, 0.9, "DCONMS", " ", " ");
            // fun.dimrot1(dxf, p25, p27, 180, dconms * 1.5, 2, 3.6 * scale, 4.8 * scale, 0.9, "LS", " ", " ");
            fun.dimrot1(dxf, p29, p37, 90, dconms / 5.0, 2, 3.6 * scale, 4.8 * scale, 0.9, "PHD", " ", " ");
            fun.jdbz2(dxf, new Line(p2, p6), new Line(p1, p3), dconms * 3, 3.6 * scale, 4.8 * scale, 0.9, "TA", " ", " ");
            /* fun.Axis(dxf, fun.Polar(p27, pi / -3, dconms * 2.5), 0, -90, "Z", "X", "Y", 1 * scale, 3.6 * scale, 1);
             fun.Axis(dxf, v1, 0, -90, " ", " ", " ", 1 * scale, 3.6 * scale, 1);
             fun.Axis(dxf, v2, 0, -90, " ", " ", " ", 1 * scale, 3.6 * scale, 1);
             fun.Axis(dxf, p0, 0, -90, " ", " ", " ", 1 * scale, 3.6 * scale, 1);
             fun.Singlelinearrow(dxf, "CCMS", v3, 60, fun.Polar(v3, pi / 3, dconms / 2.0), fun.Polar(v3, pi / 3, dconms), 3.6 * scale, 4.8 * scale);
             fun.Singlelinearrow(dxf, "FDP", v4, 180, fun.Polar(v4, 0, dconms / 2.0), fun.Polar(v4, 0, dconms), 3.6 * scale, 4.8 * scale);

             Line linev1 = new Line(v5, v6);
             Text txt1 = new Text("CIP", v7, 3.6 * scale, 2);
             Line linev2 = new Line(v8, v9);
             Text txt2 = new Text("CRP", v10, 3.6 * scale, 2);
             Line linev3 = new Line(v11, v12);
             Text txt3 = new Text("MCS", v13, 3.6 * scale, 2);
             Line linev4 = new Line(v14, v15);
             Text txt4 = new Text("PCS", v16, 3.6 * scale, 2);
             Text txt5 = new Text("ISYC=302_05", v17, 3.6 * scale, 2);
             Circle circle1 = new Circle(Pus.ToV3(p2, 0), 1 * 1.7 * scale);
            // dxf.AddEntity(new EntityObject[] { linev1, linev2, linev3, linev4, txt1, txt2, txt3, txt4, txt5, circle1 });
             // System.Diagnostics.Debug.WriteLine(tpl );*/

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Overallcenteringdrill1(Dictionary<string, Object> data)  //整体定心钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            /*
            double sl_ = 70;
            double scale = 1;

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }

            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sig = 120 ;
            double dc = 10 * scale;
            double dconms = 10 * scale;
            double lu = 13 * scale;
            double ls = 44 * scale;
            double lcf = 22 * scale;
            double oal = 70 * scale;
            double sig_ = sig * pi / 180;
            Convert.ToDouble(data["lcf"])
            */
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
             
            if (scale==0&&sl_ <= 67)
            {
                scale = 4;
            }
            else if (scale == 0 && 67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (scale == 0 && 75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            //else
            //{
            //    scale = 1;
            //}

            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sig = Convert.ToDouble(data["sig"]);
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lu = Convert.ToDouble(data["lu"]) * scale;
            double ls = Convert.ToDouble(data["ls"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double sig_ = sig * pi / 180;
           
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1 = fun.Polar(p0, (sig_ / 2.0), dc / 2.0 / Math.Sin(sig_));
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Polar(p1, -5 * pi / 180, lu / Math.Cos(5 * pi / 180));
            Vector2 p4 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p5 = fun.Polar(fun.Polar(p0, pi / 2, dconms  / 2.0), 0, lcf);
            Vector2 p6 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p7 = fun.Polar(p5, 0, oal - lcf - ls);
            Vector2 p8 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p5_1 = fun.Polar(p3, pi / -2, 0.1);
            Vector2 p5_2 = fun.Polar(p5_1, 0, oal);
            Line line1 = new Line(p5_1, p5_2);
            Vector2 p6_1 = fun.mirrorpoint(p5_1, p0_1, p0_2);
            Vector2 p6_2 = fun.mirrorpoint(p5_2, p0_1, p0_2);
            Vector2 p1_1 = fun.Polar(p1, pi / 2, 0.1);
            Vector2 p1_2 = fun.Polar(p1_1, 0, oal);
            Vector2 p2_1 = fun.Polar(p2, pi / -2, 0.1);
            Vector2 p2_2 = fun.Polar(p2_1, 0, oal);
            Line line2 = new Line(p6_1, p6_2);
            Line line3 = new Line(p1_1, p1_2);
            Line line4 = new Line(p2_1, p2_2);
            Arc arc1 = fun.DrawArc5(p3, line1, p5);
            Arc arc2 = fun.DrawArc5(p6, line2, p4);
            Arc arc3 = fun.DrawArc5(p3, line3, p1);
            Arc arc4 = fun.DrawArc5(p2, line4, p4);
            Vector2 p9 = fun.Polar(p2, 85 * pi / 180, dc / 2.5);
            Vector2 p10_ = fun.Polar(p5, -144 * pi / 180, oal);          
            Vector2 p10 = fun.Inters(p0_1, p0_2, p5, p10_);
            Arc arc5 = fun.DrawArc3(p0, p9, p10);
            Arc arc6 = fun.DrawArc4(p10, arc5.Radius, p5, 0);
            Vector2 p11 = fun.Polar(p7, 0, ls - (0.2 / 9.5) * ls);
            Vector2 p12 = fun.Polar(p11, pi / -4, (0.2 / 9.5) * ls / Math.Cos(pi/4));    
            Vector2 p13 = fun.mirrorpoint(p11, p0_1, p0_2);
            Vector2 p14 = fun.mirrorpoint(p12, p0_1, p0_2);

            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p0, p2, p9);
            var polyline2 = Pus.AddPointsToLwPolyLine( p5,p7, p8, p6);
            var polyline3 = Pus.AddPointsToLwPolyLine(p7, p11, p12, p14, p13, p11, p13, p8) ;
           /* dxf.AddEntity(new EntityObject[] { arc1, arc2, arc3, arc4,arc5,arc6
               ,polyline1,polyline2,polyline3 
                });*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            //标注
            Vector2 v1 = fun.Polar(p14, pi / 2, p12.Y);
            Vector2 v2 = fun.Polar(v1, pi, ls / 2.0);
            Vector2 v3 = fun.Polar(p8, pi / 2, p7.Y);
            Vector2 v4 = fun.Polar(p0, fun.CalAngle(p0, p2), fun.CalDistance(p0, p2)/2.0);
            Vector2 v5 = fun.Polar(p14, fun.CalAngle(p14, p13), fun.CalDistance(p14, p13)/2.0);
            Vector2 v6 = fun.Polar(p12, pi / -2, p12.Y);

            Vector2 v7 = fun.Polar(v6, pi / -4, 1.7 * 0.5*scale );
            Vector2 v8 = fun.Polar(v7, pi / -4, dc);
            Vector2 v9 = fun.Polar(v8, pi / -2, 1.2 * scale);

            Vector2 v10 = fun.Polar(v2, pi / -4, 1.7 * 0.5 * scale);
            Vector2 v11 = fun.Polar(v10, pi / -4, dc);
            Vector2 v12 = fun.Polar(v11, pi / -2, 1.2 * scale);

            Vector2 v13 = fun.Polar(p0, pi+45 * pi / 180, 1.7 * 0.5 * scale);
            Vector2 v14 = fun.Polar(v13, pi+45 * pi / 180, dc);
            Vector2 v15 = fun.Polar(v14, pi / -2, 1.2 * scale);

            Vector2 v16 = fun.Polar(p2, pi / -4, 1.7 * 0.5 * scale);
            Vector2 v17 = fun.Polar(v16, pi / -4, dc);
            Vector2 v18 = fun.Polar(v17, pi / -2, 1.2 * scale);

            Vector2 v19 = fun.Polar(v2, pi / 2, dc);
            Vector2 v20 = fun.Polar(v19, pi / 4, dc / 8);
            Vector2 v21 = fun.Polar(v20, 0, dc / 2.0);        
            Vector2 v22 = fun.mirrorpoint(v19, p0_1, p0_2);
            Vector2 v23 = fun.mirrorpoint(v20, p0_1, p0_2);
            Vector2 v24 = fun.mirrorpoint(v21, p0_1, p0_2);
          
            fun.dimrot1(dxf, p0, p3, 0, dc , 2, 1.2 * scale, 1.6 * scale, 0.9, "LU="+lu/scale , " ", " ");
            fun.dimrot1(dxf, p0, p5, 0, dc*1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF="+lcf/scale , " ", " ");
            fun.dimrot1(dxf, p1, v2, 0, dc*2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LTA", " ", " ");
            fun.dimrot1(dxf, p0, v2, 0, dc*2.7, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR", " ", " ");
            fun.dimrot1(dxf, p0, v1 , 0, dc*3.3, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL="+oal/scale , " ", " ");
            fun.dimrot1(dxf, p1, p2 , 90, dc , 2, 1.2 * scale, 1.6 * scale, 0.9, "DC="+dc/scale , " ", " ");
            fun.dimrot1(dxf, v1, v3 , 180, dc*2 , 2, 1.2 * scale, 1.6 * scale, 0.9, "LS="+ls/scale , " ", " ");
            fun.dimrot1(dxf, p2, p14, 180, dc * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LF", " ", " ");
            fun.dimrot1(dxf, p11 , p13, -90, dc , 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS="+dconms/scale , " ", " ");
            fun.dimrot1(dxf, p0, p2, 180, dc *1.5 - (v5.Y - v4.Y), 2, 1.2 * scale, 1.6 * scale, 0.9, "PL", " ", " ");
            fun.jdbz2(dxf, new Line(p2, p0), new Line(p1, p0), dconms * 2.5, 1.2 * scale, 1.6 * scale, 0.9, "SIG", " ", " ");
            fun.Axis(dxf, fun .Polar (v6,pi/-4,dc*3), 0, -90, "Z ", "X ", "Y ", 0.5 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, v6, 0, -90, " ", " ", " ", 0.5 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, v2, 0, -90, " ", " ", " ", 0.5 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, p0 , 0, -90, " ", " ", " ", 0.5 * scale, 1.2 * scale, 1);
            Line linev1 = new Line(v7, v8);
            Text txt1 = new Text("PCS", v9, 1.2 * scale, 2);
            Line linev2 = new Line(v10, v11);
            Text txt2 = new Text("MCS", v12, 1.2 * scale, 2);
            Line linev3 = new Line(v13, v14);
            Text txt3 = new Text("CIP", v15, 1.2 * scale, 2);
            Line linev4 = new Line(v16, v17);
            Text txt4 = new Text("CRP", v18, 1.2 * scale, 2);
            Circle circle1 = new Circle(Pus.ToV3(p2, 0), 0.5 * 1.7 * scale);

            Line linev5 = new Line(v20,v19);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            Line linev6 = new Line(v20, v21);
            linev6.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev6.Layer = additionalline;//Layer指图层
            linev6.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev6.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev6); //提取
            Line linev7 = new Line(v19, v22);
            linev7.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev7.Layer = additionalline;//Layer指图层
            linev7.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev7.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev7); //提取
            Line linev8 = new Line(v23, v22);
            linev8.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev8.Layer = additionalline;//Layer指图层
            linev8.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev8.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev8); //提取
            Line linev9 = new Line(v24, v23);
            linev9.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev9.Layer = additionalline;//Layer指图层
            linev9.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev9.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev9); //提取

            Line linev10 = new Line(p0_1 , p0_2 );
            linev10.Lineweight = Lineweight.W25;//Lineweight指线宽
            linev10.Layer = additionalline;//Layer指图层
            linev10.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev10.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev10); //提取

            dxf.AddEntity(new EntityObject[] { linev1, linev2, linev3, linev4, txt1, txt2, txt3, txt4, circle1 }) ;



            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ISYC_302_06(Dictionary<string, Object> data)  //整体定心钻
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            /*
            double sl_ = 70;
            double scale = 1;

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sig = 120 ;
            double dc = 10 * scale;
            double dconms = 10 * scale;
            double lu = 13 * scale;
            double ls = 44 * scale;
            double lcf = 22 * scale;
            double oal = 70 * scale;
            double sig_ = sig * pi / 180;
          */
            
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }

            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sig = Convert.ToDouble(data["sig"]);
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lu = Convert.ToDouble(data["lu"]) * scale;
            double ls = Convert.ToDouble(data["ls"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double sig_ = sig * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1 = fun.Polar(p0, (sig_ / 2.0), dc / 2.0 / Math.Sin(sig_));
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Polar(p1, -5 * pi / 180, lu / Math.Cos(5 * pi / 180));
            Vector2 p4 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p5 = fun.Polar(fun.Polar(p0, pi / 2, dconms / 2.0), 0, lcf);
            Vector2 p6 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p7 = fun.Polar(p5, 0, oal - lcf - ls);
            Vector2 p8 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p5_1 = fun.Polar(p3, pi / -2, 0.1);
            Vector2 p5_2 = fun.Polar(p5_1, 0, oal);
            Line line1 = new Line(p5_1, p5_2);
            Vector2 p6_1 = fun.mirrorpoint(p5_1, p0_1, p0_2);
            Vector2 p6_2 = fun.mirrorpoint(p5_2, p0_1, p0_2);
            Vector2 p1_1 = fun.Polar(p1, pi / 2, 0.1);
            Vector2 p1_2 = fun.Polar(p1_1, 0, oal);
            Vector2 p2_1 = fun.Polar(p2, pi / -2, 0.1);
            Vector2 p2_2 = fun.Polar(p2_1, 0, oal);
            Line line2 = new Line(p6_1, p6_2);
            Line line3 = new Line(p1_1, p1_2);
            Line line4 = new Line(p2_1, p2_2);
            Arc arc1 = fun.DrawArc5(p3, line1, p5);
            Arc arc2 = fun.DrawArc5(p6, line2, p4);
            Arc arc3 = fun.DrawArc5(p3, line3, p1);
            Arc arc4 = fun.DrawArc5(p2, line4, p4);
            Vector2 p9 = fun.Polar(p2, 85 * pi / 180, dc / 2.5);
            Vector2 p10_ = fun.Polar(p5, -144 * pi / 180, oal);
            Vector2 p10 = fun.Inters(p0_1, p0_2, p5, p10_);
            Arc arc5 = fun.DrawArc3(p0, p9, p10);
            Arc arc6 = fun.DrawArc4(p10, arc5.Radius, p5, 0);
            Vector2 p11 = fun.Polar(p7, 0, ls - (0.2 / 9.5) * ls);
            Vector2 p12 = fun.Polar(p11, pi / -4, (0.2 / 9.5) * ls / Math.Cos(pi / 4));
            Vector2 p13 = fun.mirrorpoint(p11, p0_1, p0_2);
            Vector2 p14 = fun.mirrorpoint(p12, p0_1, p0_2);

            Vector2 p15 = fun.Polar(p6, pi, lcf /19);
            Vector2 p16 = fun.Polar(p15, pi / 2, oal);
            Vector2 p17 = fun.Polar(p4, 19 * pi / 180, oal);
            Vector2 p18 = fun.Inters(p15, p16, p17, p4);
           

            Vector2 p19 = fun.Polar(p10, -11 * pi / 180, oal);
            Vector2 p20 = fun.Inters(p10, p19, p15, p16);
            Vector2 p21 = fun.Polar(p2, pi / -2, dc * 2);
            Vector2 p22 = fun.Polar(p2, pi / -2, dc * 2.3);

            Arc arc7 = fun.DrawArc4(p4, arc4.Radius, p18, 0);
            Arc arc8 = fun.DrawArc4 (p20, arc7.Radius, p10, 0);
            Arc arc9 = fun.DrawArc4(p18, (fun.CalDistance(p18, p20) / 1.9), p20,0);
            dxf.AddEntity(new EntityObject[] { arc7, arc8 ,arc9});
            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p0, p2, p9);
            var polyline2 = Pus.AddPointsToLwPolyLine(p5, p7, p8, p6);
            var polyline3 = Pus.AddPointsToLwPolyLine(p7, p11, p12, p14, p13, p11, p13, p8);
            /* dxf.AddEntity(new EntityObject[] { arc1, arc2, arc3, arc4,arc5,arc6
                ,polyline1,polyline2,polyline3 
                 });*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);
            //标注
            Vector2 v1 = fun.Polar(p14, pi / 2, p12.Y);
            Vector2 v2 = fun.Polar(v1, pi, ls / 2.0);
            Vector2 v3 = fun.Polar(p8, pi / 2, p7.Y);
            Vector2 v4 = fun.Polar(p0, fun.CalAngle(p0, p2), fun.CalDistance(p0, p2) / 2.0);
            Vector2 v5 = fun.Polar(p14, fun.CalAngle(p14, p13), fun.CalDistance(p14, p13) / 2.0);
            Vector2 v6 = fun.Polar(p12, pi / -2, p12.Y);

            Vector2 v7 = fun.Polar(v6, pi / -4, 1.7 * 0.5 * scale);
            Vector2 v8 = fun.Polar(v7, pi / -4, dc);
            Vector2 v9 = fun.Polar(v8, pi / -2, 1.2 * scale);

            Vector2 v10 = fun.Polar(v2, pi / -4, 1.7 * 0.5 * scale);
            Vector2 v11 = fun.Polar(v10, pi / -4, dc);
            Vector2 v12 = fun.Polar(v11, pi / -2, 1.2 * scale);

            Vector2 v13 = fun.Polar(p0, pi + 45 * pi / 180, 1.7 * 0.5 * scale);
            Vector2 v14 = fun.Polar(v13, pi + 45 * pi / 180, dc);
            Vector2 v15 = fun.Polar(v14, pi / -2, 1.2 * scale);

            Vector2 v16 = fun.Polar(p2, pi / -4, 1.7 * 0.5 * scale);
            Vector2 v17 = fun.Polar(v16, pi / -4, dc);
            Vector2 v18 = fun.Polar(v17, pi / -2, 1.2 * scale);

            Vector2 v19 = fun.Polar(v2, pi / 2, dc);
            Vector2 v20 = fun.Polar(v19, pi / 4, dc / 8);
            Vector2 v21 = fun.Polar(v20, 0, dc / 2.0);
            Vector2 v22 = fun.mirrorpoint(v19, p0_1, p0_2);
            Vector2 v23 = fun.mirrorpoint(v20, p0_1, p0_2);
            Vector2 v24 = fun.mirrorpoint(v21, p0_1, p0_2);


            fun.dimrot1(dxf, p0, p10, 0, dc, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", " ", " ");
            fun.dimrot1(dxf, p0, p5, 0, dc * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF", " ", " ");
           // fun.dimrot1(dxf, p1, v2, 0, dc * 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LTA", " ", " ");
            fun.dimrot1(dxf, p0, v2, 0, dc * 2.7, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR", " ", " ");
            fun.dimrot1(dxf, p0, v1, 0, dc * 3.3, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL", " ", " ");
            fun.dimrot1(dxf, p1, p2, 90, dc, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", " ", " ");
            fun.dimrot1(dxf, v1, v3, 180, dc*2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LS", " ", " ");
           // fun.dimrot1(dxf, p2, p14, 180, dc * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LF", " ", " ");
            fun.dimrot1(dxf, p11, p13, -90, dc, 2, 1.2 * scale, 1.6 * scale, 0.9, "DMM", " ", " ");
            fun.dimrot1(dxf, p0, p2, 180, dc * 1.5 - (v5.Y - v4.Y), 2, 1.2 * scale, 1.6 * scale, 0.9, "PL", " ", " ");
            fun.jdbz2(dxf, new Line(p2, p0), new Line(p1, p0), dconms * 1.4, 1.2 * scale, 1.6 * scale, 0.9, "SIG", " ", " ");

            fun.Singlelinearrow(dxf, "LF", p21, 180, fun.Polar(p21, 0, dc / 2.0), fun.Polar(p21, 0, dc),1.2*scale,1.6*scale  );

            /* fun.Axis(dxf, fun.Polar(v6, pi / -4, dc * 3), 0, -90, "Z ", "X ", "Y ", 0.5 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, v6, 0, -90, " ", " ", " ", 0.5 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, v2, 0, -90, " ", " ", " ", 0.5 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, p0, 0, -90, " ", " ", " ", 0.5 * scale, 1.2 * scale, 1);*/
            Line linev1 = new Line(v7, v8);
            Text txt1 = new Text("PCS", v9, 1.2 * scale, 2);
            Line linev2 = new Line(v10, v11);
            Text txt2 = new Text("MCS", v12, 1.2 * scale, 2);
            Line linev3 = new Line(v13, v14);
            Text txt3 = new Text("CIP", v15, 1.2 * scale, 2);
            Line linev4 = new Line(v16, v17);
            Text txt4 = new Text("CRP", v18, 1.2 * scale, 2);
            Circle circle1 = new Circle(Pus.ToV3(p2, 0), 0.5 * 1.7 * scale);

            Line linev5 = new Line(v20, v19);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            Line linev6 = new Line(v20, v21);
            linev6.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev6.Layer = additionalline;//Layer指图层
            linev6.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev6.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev6); //提取
            Line linev7 = new Line(v19, v22);
            linev7.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev7.Layer = additionalline;//Layer指图层
            linev7.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev7.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev7); //提取
            Line linev8 = new Line(v23, v22);
            linev8.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev8.Layer = additionalline;//Layer指图层
            linev8.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev8.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev8); //提取
            Line linev9 = new Line(v24, v23);
            linev9.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev9.Layer = additionalline;//Layer指图层
            linev9.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev9.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev9); //提取
            Line linev10 = new Line(p0_1, p0_2);
            linev10.Lineweight = Lineweight.W25;//Lineweight指线宽
            linev10.Layer = additionalline;//Layer指图层
            linev10.LinetypeScale = 5 / scale * 1.5;//指线性比例
            linev10.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev10); //提取

            Line linev11 = new Line(p2, p22);
            dxf.AddEntity(linev11);

            // dxf.AddEntity(new EntityObject[] { linev1, linev2, linev3, linev4, txt1, txt2, txt3, txt4, circle1 });

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Modulardrillingrig1(Dictionary<string, Object> data)  //整体非中心切削套式扩孔钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double scale = Convert.ToDouble(data["scale"]);
            /*  double scale = 5;
              double dc = 9.1*scale ;
              double pl = 0.5 * scale;
              double lcf = 12 * scale;
              double oal = 14 * scale;

              double fha = 5;
              double sig = 120;*/
            double sl_ = Convert.ToDouble(data["oal"]) * scale;
            //double scale = Convert.ToDouble(data["scale"]);
            if (scale==0&&sl_ <= 67)
            {
                scale = 4;
            }
            else if (scale == 0 && 67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (scale == 0 && 75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            //else
            //{
            //    scale = 1;
            //}
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double pl = Convert.ToDouble(data["pl"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            
            double fha = Convert.ToDouble(data["fha"]);
            double sig = Convert.ToDouble(data["sig"]);
            double sig_ = sig * pi / 180;
            double fha_ = fha * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 20);
            Vector2 p0_2 = fun.Polar(p0, 0, oal + 10);
            Vector2 p1 = fun.Polar(p0, pi / 2.0, dc / 25.0);
            Vector2 p2 = fun.Polar(p0, pi / -2, dc / 25.0);
            Vector2 p3 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p4 = fun.Polar(p3, 0, lcf - pl);
            Vector2 p5 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p6 = fun.Polar(p4, -sig_ / 2.0, pl / Math.Cos(sig_ / 2));
            Vector2 p7 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p9_1 = fun.Polar(p4, pi, 0.1);
            Vector2 p9_2 = fun.Polar(p9_1, pi / -2, oal);
           
            Vector2 p10_ = fun.Polar(p2, -fha_, oal);
            Vector2 p10 = fun.Inters(p2, p10_, p9_1, p9_2);
            Vector2 p11_ = fun.Polar(p1, -fha_, oal);
            Vector2 p11 = fun.Inters(p1, p11_, p9_1, p9_2);
            Vector2 p12 = fun.Polar(p0, pi / 2, fun.CalDistance(p3, p0) * 3.0 / 5.0);
            Vector2 p13 = fun.Polar(p12, pi / 2, dc / 15);
            Vector2 p14_ = fun.Polar(p12, -fha_, oal);
            Vector2 p14 = fun.Inters(p12, p14_, p9_1, p9_2);
            Vector2 p15_ = fun.Polar(p13, -fha_, oal);
            Vector2 p15 = fun.Inters(p13, p15_, p9_1, p9_2);
            Vector2 p16 = fun.Polar(p0, pi / -2, fun.CalDistance(p3, p0) * 3.0 / 5.0);
            Vector2 p16_ = fun.Polar(p16, -fha_-2*pi/180, oal);
            Vector2 p17 = fun.Polar(p16, pi / -2, dc / 15);
            Vector2 p17_ = fun.Polar(p17 , -fha_-2*pi/180, oal);
            Vector2 p18 = fun.Inters(p16, p16_, p9_1, p9_2);
            Vector2 p19 = fun.Inters(p17, p17_, p8, p5);
            Vector2 p20_ = fun.Polar(p15, fha_+10*pi/180, oal);
            Vector2 p20 = fun.Inters(p15, p20_, p6, p7);
            Vector2 p21_ = fun.Polar(p14, fha_ + 10 * pi / 180, oal);
            Vector2 p21 = fun.Inters(p14, p21_, p6, p7);
            Vector2 p22_ = fun.Polar(p11, fha_ + 10 * pi / 180, oal);
            Vector2 p22 = fun.Inters(p11, p22_, p6, p7);
            Vector2 p23_ = fun.Polar(p10, fha_ + 10 * pi / 180, oal);
            Vector2 p23 = fun.Inters(p10, p23_, p6, p7);
            Vector2 p24_ = fun.Polar(p18, fha_+2*pi/180, oal);
            Vector2 p24 = fun.Inters(p18, p24_, p5, p7);
            Vector2 p25 = fun.Polar(p3, pi / -2, fun.CalDistance(p3, p13) / 2.0);
            Vector2 p26 = fun.mirrorpoint(p25, p0_1, p0_2);
            Vector2 p27 = fun.Polar(p25, pi, oal - lcf);
            Vector2 p28 = fun.mirrorpoint(p27, p0_1, p0_2);
            Vector2 p29_1 = fun.Polar(p0, pi,fun .CalDistance(p27, p25));
            Vector2 p29_2 = fun.Polar(p29_1, pi / 2, dc / 7.0/2.0);
            Vector2 p29 = fun.Polar(p29_2, pi / 2, 0.4*scale );
            Vector2 p30 = fun.Polar(p29_2, 0, 0.4*scale );
            Vector2 p31 = fun.mirrorpoint(p29, p0_1, p0_2);
            Vector2 p32 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p33_1 = fun.Polar(p0, pi, (oal - lcf) / 5.0);
            Vector2 p33_2 = fun.Polar(p33_1, pi / 2, dc / 7.0 / 2.0);
            Vector2 p33 = fun.Polar(p33_2, pi, 0.2*scale );
            Vector2 p34 = fun.Polar(p33_2, pi / -2, 0.2*scale );
            Vector2 p35 = fun.mirrorpoint(p33, p0_1, p0_2);
            Vector2 p36 = fun.mirrorpoint(p34, p0_1, p0_2);

            Vector2 p37 = fun.Polar(p1, pi / 2, fun.CalDistance(p1, p12) / 3.0*2);
            Vector2 p38_1 = fun.Polar(p4, pi, lcf / 3.0);
            Vector2 p38_2 = fun.Polar(p38_1, pi / -2, oal);
            Vector2 p38 = fun.Inters(p38_1, p38_2, p12, p14);
            Vector2 p39_1 = fun.Polar(p14, pi, oal);
            Vector2 p39_2 = fun.Polar(p38, pi / -4, oal);
            Vector2 p39 = fun.Inters(p38, p39_2, p14, p39_1);
            Vector2 p40 = fun.Polar(p37, 0, lcf / 3.0);
            Vector2 p41_1 = fun.Polar(p40, pi / 4, oal);
            Vector2 p41_2 = fun.Polar(p38, pi, oal);
            Vector2 p41 = fun.Inters(p40, p41_1, p38, p41_2);
            Vector2 p42 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p43 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p41, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p38, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p39, p0_1, p0_2);
            Vector2 p47_ = fun.Polar(p46, 0, oal);
            Vector2 phx_1 = fun.Polar(p4, pi, 0.2);
            Vector2 phx_2 = fun.Polar(phx_1, pi / -2 - 0.1 * pi / 180, oal);
            Line line1 = new Line(phx_1, phx_2);
            Arc arc3 = fun.DrawArc5(p10, line1, p18);
            Vector2 p47 = fun.Inters1(p46, p47_, arc3, 0);
            Vector2 p48_ = fun.Polar(p47, pi / -4, oal);
            Vector2 p48 = fun.Inters(p47, p48_, p6, p7);
            Vector2 p49 = fun.Polar(p0, 0, oal + dc * 2);
            Vector2 p50 = fun.Polar(p49, pi / 2, dc / 2.0);
            Vector2 p51 = fun.Polar(p50, 0, dc / 2.0);
            Vector2 p52 = fun.Polar(p50, pi / 2, dc / 4.0);
            Vector2 p53 = fun.Polar(p52, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54 = fun.Polar(p53, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55 = fun.Polar(p54, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56 = fun.Polar(p55, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57 = fun.Polar(p56, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58 = fun.mirrorpoint(p50, p0_1, p0_2);
            Vector2 p59 = fun.mirrorpoint(p51, p0_1, p0_2);
            Vector2 p60 = fun.mirrorpoint(p52, p0_1, p0_2);
            Vector2 p61 = fun.mirrorpoint(p53, p0_1, p0_2);
            Vector2 p62 = fun.mirrorpoint(p54, p0_1, p0_2);
            Vector2 p63 = fun.mirrorpoint(p55, p0_1, p0_2);
            Vector2 p64 = fun.mirrorpoint(p56, p0_1, p0_2);
            Vector2 p65 = fun.mirrorpoint(p57, p0_1, p0_2);

            Line line2 = new Line(p30, p33);
            Line line3 = new Line(p32, p35);
            Line line4 = new Line(p34, p36);

            Line line5 = new Line(p47, p48);
            line5.Lineweight = Lineweight.W35;//Lineweight指线宽
            line5.Layer = refin;//Layer指图层
            line5.LinetypeScale = 1 * scale;//指线性比例
            line5.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line6 = new Line(p37, p40);
            line6.Lineweight = Lineweight.W35;//Lineweight指线宽
            line6.Layer = refin;//Layer指图层
            line6.LinetypeScale = 1 * scale;//指线性比例
            line6.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line7 = new Line(p40, p41);
            line7.Lineweight = Lineweight.W35;//Lineweight指线宽
            line7.Layer = refin;//Layer指图层
            line7.LinetypeScale = 1 * scale;//指线性比例
            line7.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line8 = new Line(p41, p38);
            line8.Lineweight = Lineweight.W35;//Lineweight指线宽
            line8.Layer = refin;//Layer指图层
            line8.LinetypeScale = 1 * scale;//指线性比例
            line8.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line9 = new Line(p38, p39);
            line9.Lineweight = Lineweight.W35;//Lineweight指线宽
            line9.Layer = refin;//Layer指图层
            line9.LinetypeScale = 1 * scale;//指线性比例
            line9.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line10 = new Line(p39, p14);
            line10.Lineweight = Lineweight.W35;//Lineweight指线宽
            line10.Layer = refin;//Layer指图层
            line10.LinetypeScale = 1 * scale;//指线性比例
            line10.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line11 = new Line(p42, p43);
            line11.Lineweight = Lineweight.W35;//Lineweight指线宽
            line11.Layer = refin;//Layer指图层
            line11.LinetypeScale = 1 * scale;//指线性比例
            line11.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line12 = new Line(p43, p44);
            line12.Lineweight = Lineweight.W35;//Lineweight指线宽
            line12.Layer = refin;//Layer指图层
            line12.LinetypeScale = 1 * scale;//指线性比例
            line12.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line13 = new Line(p44, p45);
            line13.Lineweight = Lineweight.W35;//Lineweight指线宽
            line13.Layer = refin;//Layer指图层
            line13.LinetypeScale = 1 * scale;//指线性比例
            line13.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line14 = new Line(p45, p46);
            line14.Lineweight = Lineweight.W35;//Lineweight指线宽
            line14.Layer = refin;//Layer指图层
            line14.LinetypeScale = 1 * scale;//指线性比例
            line14.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line15 = new Line(p46, p47);
            line15.Lineweight = Lineweight.W35;//Lineweight指线宽
            line15.Layer = refin;//Layer指图层
            line15.LinetypeScale = 1 * scale;//指线性比例
            line15.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line16 = new Line(p40, p43);
            line16.Lineweight = Lineweight.W35;//Lineweight指线宽
            line16.Layer = refin;//Layer指图层
            line16.LinetypeScale = 1 * scale;//指线性比例
            line16.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line17 = new Line(p41, p44);
            line17.Lineweight = Lineweight.W35;//Lineweight指线宽
            line17.Layer = refin;//Layer指图层
            line17.LinetypeScale = 1 * scale;//指线性比例
            line17.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line18 = new Line(p38, p45);
            line18.Lineweight = Lineweight.W35;//Lineweight指线宽
            line18.Layer = refin;//Layer指图层
            line18.LinetypeScale = 1 * scale;//指线性比例
            line18.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            Line line19 = new Line(p39, p46);
            line19.Lineweight = Lineweight.W35;//Lineweight指线宽
            line19.Layer = refin;//Layer指图层
            line19.LinetypeScale = 1*scale  ;//指线性比例
            line19.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
            Line line20 = new Line(p0_1, p0_2);
            line20.Lineweight = Lineweight.W25;//Lineweight指线宽
            line20.Layer = center;//Layer指图层
            line20.LinetypeScale = 1 * scale;//指线性比例
            line20.Linetype = Linetype.DashDot ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line20);
            Arc arc1 = fun.DrawArc5(p4, line1, p15);
            Arc arc2 = fun.DrawArc5(p14, line1, p11);
          
            Arc arc4 = fun.DrawArc4(p29, 0.4*scale , p30,0);
            Arc arc5 = fun.DrawArc4(p32, 0.4*scale , p31,0);
            Arc arc6 = fun.DrawArc4(p34, 0.2*scale , p33, 0);
            Arc arc7 = fun.DrawArc4(p35, 0.2*scale , p36, 0);

            var polyline1 = Pus.AddPointsToLwPolyLine(p29, p27, p25, p3, p4, p6, p7, p5, p8, p3, p26, p28, p31);
            var polyline2 = Pus.AddPointsToLwPolyLine(p1, p11, p10, p2, p13, p15, p14, p12, p16, p18, p5
                , p19, p17) ;
            var polyline3 = Pus.AddPointsToLwPolyLine(p15, p20, p21, p14, p21, p22, p11, p22, p23, p10, p23,p7, p24, p18);
            //polyline3.Linetype = centre;
            var polyline4 = Pus.AddPointsToLwPolyLine(p50, p52, p53, p54, p55, p56, p57, p51, p50);
            var polyline5 = Pus.AddPointsToLwPolyLine(p58, p60, p61, p62, p63, p64, p65, p59, p58);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            fun.PolyFill(dxf, polyline5, 0.5, contour);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBline(dxf, line2, 0.5, contour);
            fun.drawBline(dxf, line3, 0.5, contour);
            fun.drawBline(dxf, line4, 0.5, contour);
            dxf.AddEntity(new EntityObject[] { 
                line2,line3,line4,line5,line6,line7,line8,line9,line10,line11,line12,line13,line14,line15
                ,line16,line17,line18,line19
            }) ;

            ////标注
            //Vector2 v1 = fun.Polar(p8, pi + 70 * pi / 180, dc *1.2);
            //Vector2 v2 = fun.Inters(p7, fun.Polar(p7, pi / 2, oal), p0, p0_2);
            //Vector2 v3 = fun.Polar(p37, pi, (fun.CalDistance(p27, p25)) * 1.5);
            //Vector2 v4 = fun.Polar(p4, pi / 6, dc*2.5);
            //Vector2 v5 = fun.Polar(p29_1, pi/2.0 + 40 * pi / 180, 0.2 * scale);
            //Vector2 v6 = fun.Polar(v5, pi/2.0 + 40 * pi / 180, dc * 1.8);
            //Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            //Vector2 v8 = fun.Polar(v2, -60 * pi / 180, 0.2 * scale);
            //Vector2 v9 = fun.Polar(v8, -60 * pi / 180, dc);
            //Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            //Vector2 v11 = fun.Polar(p5, pi + pi / 4, 1.7*0.2 * scale);
            //Vector2 v12 = fun.Polar(v11, pi + pi / 6, dc/2.0);
            //Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            //Vector2 v14 = fun.Polar(p3, pi / 2, dc * 1.6);
            ////标注
            Vector2 v1 = fun.Polar(p8, pi + 70 * pi / 180, dc * 1.2);
            Vector2 v2 = fun.Inters(p7, fun.Polar(p7, pi / 2, oal), p0, p0_2);
            Vector2 v3 = fun.Polar(p37, pi, (fun.CalDistance(p27, p25)) * 1.5);
            Vector2 v4 = fun.Polar(p4, pi / 6, dc * 2.5);
            Vector2 v5 = fun.Polar(p29_1, pi / 2.0 + 40 * pi / 180, 0.2 * scale);
            Vector2 v6 = fun.Polar(v5, pi / 2.0 + 40 * pi / 180, dc * 1.8);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            Vector2 v8 = fun.Polar(v2, -60 * pi / 180, 0.2 * scale);
            Vector2 v9 = fun.Polar(v8, -60 * pi / 180, dc);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p5, pi + pi / 4, 1.7 * 0.2 * scale);
            Vector2 v12 = fun.Polar(v11, pi + pi / 6, dc / 2.0);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            Vector2 v14 = fun.Polar(p3, pi / 2, dc * 1.6);
            fun.dimrot1(dxf, p3, p6, 0, dc, 2, 0.8 * scale, 1.2 * scale, 0.9, "LCF="+lcf/scale , "", "");
            fun.dimrot1(dxf, p27, p6, 0, dc * 1.5, 2, 0.8 * scale, 1.2 * scale, 0.9, "OAL,LPR="+oal/scale , "", "");
            fun.dimrot1(dxf, p7, p6, -90, dc * 1.2, 2, 0.8 * scale, 1.2 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p4, p5, -90, dc * 1.6, 2, 0.8 * scale, 1.2 * scale, 0.9, "DC="+dc/scale , "", "");
            fun.dimrot1(dxf, p5, p7, 180, dc, 2, 0.8 * scale, 1.2 * scale, 0.9, "PL="+pl/scale , "", "");
            fun.dimrot1(dxf, p28, p5, 180, dc - (((p5.Y - p28.Y) / 2.0 - (p5.Y - p7.Y) / 2.0)), 2, 0.8 * scale, 1.2 * scale, 0.9, "LTA,LF", "", "");
            fun.dimrot1(dxf, p17, p37, 90, dc, 2, 0.8 * scale, 1.2 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, p27, p28, 90, dc * 1.5, 2, 0.8 * scale, 1.2 * scale, 0.9, "DHUB", "", "");
            fun.dimrot1(dxf, p51, p59, 90, dc /8.0, 2, 0.8 * scale, 1.2 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line (p4,p6), new Line (p5,p7), dc /2.0, 0.8 * scale, 1.2 * scale, 0.9, "SIG", "", "");
            fun.jdbz2(dxf, new Line(p19, p17),new Line (p17, fun .Polar (p17,pi,0.1)), dc / 2.0, 0.8 * scale, 1.2 * scale, 0.9, "FHA", "", "");
            fun.Axis(dxf, v1, 180, -90, "Z", "X", "Y", 0.2 * scale, 0.8 * scale, 0);
            fun.Axis(dxf, p29_1 , 180, -90, " ", " ", " ", 0.2 * scale, 0.8 * scale, 0);
            fun.Axis(dxf, v2, 180, -90, " ", " ", " ", 0.2 * scale, 0.8 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v3,120, fun.Polar(v3, pi / 2 + 30 * pi / 180, dc / 2.0), fun.Polar(v3, pi / 2 + 30 * pi / 180, dc), 0.8 * scale, 1.2 * scale);
            fun.Singlelinearrow(dxf, "FDP", v4, 0, fun.Polar(v4, pi, dc / 2.0), fun.Polar(v4, pi, dc), 0.8 * scale, 1.2 * scale);
            Line linev1 = new Line(v5, v6);
            Line linev2 = new Line(v8, v9);
            Line linev3 = new Line(v11, v12);
            Text txt1 = new Text("PCS,MCS", v6, 0.8*scale , 2);
            Text txt2 = new Text("CIP", v10, 0.8 * scale, 2);
            Text txt3 = new Text("CRP", v13, 0.8 * scale, 2);
            Text txt4 = new Text("ISYC=302_08", v14, 0.8 * scale, 2);
            Circle circle1 = new Circle(Pus .ToV3 (p5,0),1.7* 0.2*scale );
            dxf.AddEntity(new EntityObject[] { linev1,linev2,linev3
                , txt1,txt2,txt3 ,txt4
            ,circle1 }) ;


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);

            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }



            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ISYC_302_08(Dictionary<string, Object> data)  //整体非中心切削套式扩孔钻
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            /*double scale = 5;
            double dc = 9.1 * scale;
            double pl = 0.5 * scale;
            double lcf = 12 * scale;
            double oal = 14 * scale;

            double fha = 5;
            double sig = 120;*/
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);

            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double pl = Convert.ToDouble(data["pl"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double fha = Convert.ToDouble(data["fha"]);
            double sig = Convert.ToDouble(data["sig"]);
            double sig_ = sig * pi / 180;
            double fha_ = fha * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 20);
            Vector2 p0_2 = fun.Polar(p0, 0, oal + 10);
            Vector2 p1 = fun.Polar(p0, pi / 2.0, dc / 25.0);
            Vector2 p2 = fun.Polar(p0, pi / -2, dc / 25.0);
            Vector2 p3 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p4 = fun.Polar(p3, 0, lcf - pl);
            Vector2 p5 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p6 = fun.Polar(p4, -sig_ / 2.0, pl / Math.Cos(sig_ / 2));
            Vector2 p7 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p9_1 = fun.Polar(p4, pi, 0.1);
            Vector2 p9_2 = fun.Polar(p9_1, pi / -2, oal);

            Vector2 p10_ = fun.Polar(p2, -fha_, oal);
            Vector2 p10 = fun.Inters(p2, p10_, p9_1, p9_2);
            Vector2 p11_ = fun.Polar(p1, -fha_, oal);
            Vector2 p11 = fun.Inters(p1, p11_, p9_1, p9_2);
            Vector2 p12 = fun.Polar(p0, pi / 2, fun.CalDistance(p3, p0) * 3.0 / 5.0);
            Vector2 p13 = fun.Polar(p12, pi / 2, dc / 15);
            Vector2 p14_ = fun.Polar(p12, -fha_, oal);
            Vector2 p14 = fun.Inters(p12, p14_, p9_1, p9_2);
            Vector2 p15_ = fun.Polar(p13, -fha_, oal);
            Vector2 p15 = fun.Inters(p13, p15_, p9_1, p9_2);
            Vector2 p16 = fun.Polar(p0, pi / -2, fun.CalDistance(p3, p0) * 3.0 / 5.0);
            Vector2 p16_ = fun.Polar(p16, -fha_ - 2 * pi / 180, oal);
            Vector2 p17 = fun.Polar(p16, pi / -2, dc / 15);
            Vector2 p17_ = fun.Polar(p17, -fha_ - 2 * pi / 180, oal);
            Vector2 p18 = fun.Inters(p16, p16_, p9_1, p9_2);
            Vector2 p19 = fun.Inters(p17, p17_, p8, p5);
            Vector2 p20_ = fun.Polar(p15, fha_ + 10 * pi / 180, oal);
            Vector2 p20 = fun.Inters(p15, p20_, p6, p7);
            Vector2 p21_ = fun.Polar(p14, fha_ + 10 * pi / 180, oal);
            Vector2 p21 = fun.Inters(p14, p21_, p6, p7);
            Vector2 p22_ = fun.Polar(p11, fha_ + 10 * pi / 180, oal);
            Vector2 p22 = fun.Inters(p11, p22_, p6, p7);
            Vector2 p23_ = fun.Polar(p10, fha_ + 10 * pi / 180, oal);
            Vector2 p23 = fun.Inters(p10, p23_, p6, p7);
            Vector2 p24_ = fun.Polar(p18, fha_ + 2 * pi / 180, oal);
            Vector2 p24 = fun.Inters(p18, p24_, p5, p7);
            Vector2 p25 = fun.Polar(p3, pi / -2, fun.CalDistance(p3, p13) / 2.0);
            Vector2 p26 = fun.mirrorpoint(p25, p0_1, p0_2);
            Vector2 p27 = fun.Polar(p25, pi, oal - lcf);
            Vector2 p28 = fun.mirrorpoint(p27, p0_1, p0_2);
            Vector2 p29_1 = fun.Polar(p0, pi, fun.CalDistance(p27, p25));
            Vector2 p29_2 = fun.Polar(p29_1, pi / 2, dc / 7.0 / 2.0);
            Vector2 p29 = fun.Polar(p29_2, pi / 2, 0.4 * scale);
            Vector2 p30 = fun.Polar(p29_2, 0, 0.4 * scale);
            Vector2 p31 = fun.mirrorpoint(p29, p0_1, p0_2);
            Vector2 p32 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p33_1 = fun.Polar(p0, pi, (oal - lcf) / 5.0);
            Vector2 p33_2 = fun.Polar(p33_1, pi / 2, dc / 7.0 / 2.0);
            Vector2 p33 = fun.Polar(p33_2, pi, 0.2 * scale);
            Vector2 p34 = fun.Polar(p33_2, pi / -2, 0.2 * scale);
            Vector2 p35 = fun.mirrorpoint(p33, p0_1, p0_2);
            Vector2 p36 = fun.mirrorpoint(p34, p0_1, p0_2);

            Vector2 p37 = fun.Polar(p1, pi / 2, fun.CalDistance(p1, p12) / 3.0 * 2);
            Vector2 p38_1 = fun.Polar(p4, pi, lcf / 3.0);
            Vector2 p38_2 = fun.Polar(p38_1, pi / -2, oal);
            Vector2 p38 = fun.Inters(p38_1, p38_2, p12, p14);
            Vector2 p39_1 = fun.Polar(p14, pi, oal);
            Vector2 p39_2 = fun.Polar(p38, pi / -4, oal);
            Vector2 p39 = fun.Inters(p38, p39_2, p14, p39_1);
            Vector2 p40 = fun.Polar(p37, 0, lcf / 3.0);
            Vector2 p41_1 = fun.Polar(p40, pi / 4, oal);
            Vector2 p41_2 = fun.Polar(p38, pi, oal);
            Vector2 p41 = fun.Inters(p40, p41_1, p38, p41_2);
            Vector2 p42 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p43 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p41, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p38, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p39, p0_1, p0_2);
            Vector2 p47_ = fun.Polar(p46, 0, oal);
            Vector2 phx_1 = fun.Polar(p4, pi, 0.2);
            Vector2 phx_2 = fun.Polar(phx_1, pi / -2 - 0.1 * pi / 180, oal);
            Line line1 = new Line(phx_1, phx_2);    
            Arc arc3 = fun.DrawArc5(fun .Polar (p6,pi/-2,fun .CalDistance (p6,p7)/2.0), line1, p18);
            Vector2 p47 = fun.Inters1(p46, p47_, arc3, 0);
            Vector2 p48_ = fun.Polar(p47, pi / -4, oal);
            Vector2 p48 = fun.Inters(p47, p48_, p6, p7);
            Vector2 p49 = fun.Polar(p0, 0, oal + dc * 2);
            Vector2 p50 = fun.Polar(p49, pi / 2, dc / 2.0);
            Vector2 p51 = fun.Polar(p50, 0, dc / 2.0);
            Vector2 p52 = fun.Polar(p50, pi / 2, dc / 4.0);
            Vector2 p53 = fun.Polar(p52, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54 = fun.Polar(p53, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55 = fun.Polar(p54, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56 = fun.Polar(p55, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57 = fun.Polar(p56, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58 = fun.mirrorpoint(p50, p0_1, p0_2);
            Vector2 p59 = fun.mirrorpoint(p51, p0_1, p0_2);
            Vector2 p60 = fun.mirrorpoint(p52, p0_1, p0_2);
            Vector2 p61 = fun.mirrorpoint(p53, p0_1, p0_2);
            Vector2 p62 = fun.mirrorpoint(p54, p0_1, p0_2);
            Vector2 p63 = fun.mirrorpoint(p55, p0_1, p0_2);
            Vector2 p64 = fun.mirrorpoint(p56, p0_1, p0_2);
            Vector2 p65 = fun.mirrorpoint(p57, p0_1, p0_2);
            Vector2 p66 = fun.Polar(p37, 0, lcf / 20.0);
            Vector2 p67_ = fun.Polar(p66, pi / -2, oal);
            Vector2 p67 = fun.Inters(p66, p67_, p0_1, p0_2);
            Vector2 p68 = fun.Polar(p66, pi / 2, lcf / 20.0);
            Vector2 p69_ = fun.Polar(p68, pi, oal);
            Vector2 p69 = fun.Inters(p68, p69_, p27, p29);
            Vector2 p70_ = fun.Polar(p6, pi, oal);
            Vector2 p70 = fun.Inters(p6, p70_, p27, p29);
            Line line2 = new Line(p30, p33);
            Line line3 = new Line(p32, p35);
            Line line4 = new Line(p34, p36);

            Line line5 = new Line(p68, p67);
            line5.Lineweight = Lineweight.W35;//Lineweight指线宽
            line5.Layer = refin;//Layer指图层
            Line line6 = new Line(p66, p40);
            line6.Lineweight = Lineweight.W35;//Lineweight指线宽
            line6.Layer = refin;//Layer指图层            
            Line line7 = new Line(p40, p41);
            line7.Lineweight = Lineweight.W35;//Lineweight指线宽
            line7.Layer = refin;//Layer指图层         
            Line line8 = new Line(p41, p38);
            line8.Lineweight = Lineweight.W35;//Lineweight指线宽
            line8.Layer = refin;//Layer指图层
            Line line9 = new Line(p38, p39);
            line9.Lineweight = Lineweight.W35;//Lineweight指线宽
            line9.Layer = refin;//Layer指图层
            Line line10 = new Line(p39, p14);
            line10.Lineweight = Lineweight.W35;//Lineweight指线宽
            line10.Layer = refin;//Layer指图层
            Line line11 = new Line(p68, p69);
            line11.Lineweight = Lineweight.W35;//Lineweight指线宽
            line11.Layer = refin;//Layer指图层
            Line line12 = new Line(p6, p70);
            line12.Lineweight = Lineweight.W35;//Lineweight指线宽
            line12.Layer = refin;//Layer指图层
            Line line16 = new Line(p40, fun.Inters(p40, fun.Polar(p40, pi / -2, oal), p0_1, p0_2)) ;
            line16.Lineweight = Lineweight.W35;//Lineweight指线宽
            line16.Layer = refin;//Layer指图层
            Line line17 = new Line(p41, fun.Inters(p41, fun.Polar(p41, pi / -2, oal), p0_1, p0_2));
            line17.Lineweight = Lineweight.W35;//Lineweight指线宽
            line17.Layer = refin;//Layer指图层
            Line line18 = new Line(p38, fun.Inters(p38, fun.Polar(p38, pi / -2, oal), p0_1, p0_2));
            line18.Lineweight = Lineweight.W35;//Lineweight指线宽
            line18.Layer = refin;//Layer指图层
            Line line19 = new Line(p39, fun.Inters(p39, fun.Polar(p39, pi / -2, oal), p0_1, p0_2));
            line19.Lineweight = Lineweight.W35;//Lineweight指线宽
            line19.Layer = refin;//Layer指图层
            Line line20 = new Line(p0_1, p0_2);
            line20.Lineweight = Lineweight.W25;//Lineweight指线宽
            line20.Layer = centre;//Layer指图层
            dxf.AddEntity(line20);
            Line line21 = new Line(p14, fun .Inters (p14,fun .Polar (p14,pi/-2,oal),p0_1 ,p0_2 ));
            line21.Lineweight = Lineweight.W35;//Lineweight指线宽
            line21.Layer = centre;//Layer指图层          
            //Arc arc1 = fun.DrawArc5(p4, line1, p15);
            //Arc arc2 = fun.DrawArc5(p14, line1, p11);

            Arc arc4 = fun.DrawArc4(p29, 0.4 * scale, p30, 0);
            Arc arc5 = fun.DrawArc4(p32, 0.4 * scale, p31, 0);
            Arc arc6 = fun.DrawArc4(p34, 0.2 * scale, p33, 0);
            Arc arc7 = fun.DrawArc4(p35, 0.2 * scale, p36, 0);

            var polyline1 = Pus.AddPointsToLwPolyLine(p29, p27, p25, p3, p4, p6, p7, p5, p8, p0, p26, p28, p31);
            var polyline2 = Pus.AddPointsToLwPolyLine( p16, p18, p5 , p19, p17,p0);
            var polyline3 = Pus.AddPointsToLwPolyLine( p21, p14, p21, p7, p24, p18);
            //polyline3.Linetype = centre;
            var polyline4 = Pus.AddPointsToLwPolyLine(p6, p70, p69, p68, p66, p40, p41, p38, p39, p14, p21, p6) ;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline4.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline4.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline4.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline4.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 135, 5, hline1, harc1, hatching);
            // var polyline5 = Pus.AddPointsToLwPolyLine(p58, p60, p61, p62, p63, p64, p65, p59, p58);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            //fun.PolyFill(dxf, polyline4, 0.5, contour);
            //fun.PolyFill(dxf, polyline5, 0.5, contour);
            //fun.drawBArc(dxf, arc1, 0.5, contour);
            //fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBline(dxf, line2, 0.5, contour);
            fun.drawBline(dxf, line3, 0.5, contour);
            fun.drawBline(dxf, line4, 0.5, contour);
            fun.drawBline(dxf, line21, 0.5, contour);
            dxf.AddEntity(new EntityObject[] {
                line2,line3,line4,line5,line6,line7,line8,line9,line10,line11,line12
                ,line16,line17,line18,line19
            });
            
            //标注
            Vector2 v1 = fun.Polar(p8, pi + 70 * pi / 180, dc * 1.2);
            Vector2 v2 = fun.Inters(p7, fun.Polar(p7, pi / 2, oal), p0, p0_2);
            Vector2 v3 = fun.Polar(p37, pi, (fun.CalDistance(p27, p25)) * 1.5);
            Vector2 v4 = fun.Polar(p4, pi / 6, dc * 2.5);
            Vector2 v5 = fun.Polar(p29_1, pi / 2.0 + 40 * pi / 180, 0.2 * scale);
            Vector2 v6 = fun.Polar(v5, pi / 2.0 + 40 * pi / 180, dc * 1.8);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            Vector2 v8 = fun.Polar(v2, -60 * pi / 180, 0.2 * scale);
            Vector2 v9 = fun.Polar(v8, -60 * pi / 180, dc);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p5, pi + pi / 4, 1.7 * 0.2 * scale);
            Vector2 v12 = fun.Polar(v11, pi + pi / 6, dc / 2.0);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            Vector2 v14 = fun.Polar(p3, pi / 2, dc * 1.6);
            //fun.dimrot1(dxf, p3, p6, 0, dc, 2, 0.8 * scale, 1.2 * scale, 0.9, "LCF", "", "");
            fun.dimrot1(dxf, p27, p6, 0, dc /2.0, 2, 0.8 * scale, 1.2 * scale, 0.9, "OAL,LPR", "", "");
            fun.dimrot1(dxf, p7, p6, -90, dc * 1.2, 2, 0.8 * scale, 1.2 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p4, p5, -90, dc * 1.6, 2, 0.8 * scale, 1.2 * scale, 0.9, "DC", "", "");
            //fun.dimrot1(dxf, p5, p7, 180, dc, 2, 0.8 * scale, 1.2 * scale, 0.9, "PL", "", "");
            fun.dimrot1(dxf, p28, p5, 180, (dc - (((p5.Y - p28.Y) / 2.0 - (p5.Y - p7.Y) / 2.0)))/2.0, 2, 0.8 * scale, 1.2 * scale, 0.9, "LF", "", "");
            fun.dimrot1(dxf, p17, p37, 90, dc, 2, 0.8 * scale, 1.2 * scale, 0.9, "DCB", "", "");
            fun.dimrot1(dxf, p27, p28, 90, dc * 1.5, 2, 0.8 * scale, 1.2 * scale, 0.9, "DF", "", "");
            //fun.dimrot1(dxf, p51, p59, 90, dc / 8.0, 2, 0.8 * scale, 1.2 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line(p4, p6), new Line(p5, p7), dc / 2.0, 0.8 * scale, 1.2 * scale, 0.9, "SIG", "", "");
            fun.jdbz2(dxf, new Line(p19, p17), new Line(p17, fun.Polar(p17, pi, 0.1)), dc / 2.0, 0.8 * scale, 1.2 * scale, 0.9, "FHA", "", "");
           /* fun.Axis(dxf, v1, 180, -90, "Z", "X", "Y", 0.2 * scale, 0.8 * scale, 0);
            fun.Axis(dxf, p29_1, 180, -90, " ", " ", " ", 0.2 * scale, 0.8 * scale, 0);
            fun.Axis(dxf, v2, 180, -90, " ", " ", " ", 0.2 * scale, 0.8 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v3, 120, fun.Polar(v3, pi / 2 + 30 * pi / 180, dc / 2.0), fun.Polar(v3, pi / 2 + 30 * pi / 180, dc), 0.8 * scale, 1.2 * scale);
            fun.Singlelinearrow(dxf, "FDP", v4, 0, fun.Polar(v4, pi, dc / 2.0), fun.Polar(v4, pi, dc), 0.8 * scale, 1.2 * scale);*/
            Line linev1 = new Line(v5, v6);
            Line linev2 = new Line(v8, v9);
            Line linev3 = new Line(v11, v12);
            Text txt1 = new Text("PCS,MCS", v6, 0.8 * scale, 2);
            Text txt2 = new Text("CIP", v10, 0.8 * scale, 2);
            Text txt3 = new Text("CRP", v13, 0.8 * scale, 2);
            Text txt4 = new Text("ISYC=302_08", v14, 0.8 * scale, 2);
            Circle circle1 = new Circle(Pus.ToV3(p5, 0), 1.7 * 0.2 * scale);
            /* dxf.AddEntity(new EntityObject[] { linev1,linev2,linev3
                 , txt1,txt2,txt3 ,txt4
             ,circle1 });*/

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Settypecountersunkdrillbit(Dictionary<string, Object> data)  //  整体套式平底锪钻头
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);

            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
          
            /* double sl_ = 120;
             double scale = 1;
             if (sl_ <= 67)
             {
                 scale = 4;
             }
             else if (67 < sl_ && sl_ <= 75)
             {
                 scale = 2.5;
             }
             else if (75 < sl_ && sl_ <= 100)
             {
                 scale = 2;
             }
             else
             {
                 scale = 1;
             }

             double dconms = 20*scale ;
             double dhub = 36*scale ;
             double oal = 40*scale ;
             double lf = 40*scale ;
             double lcf = 36*scale ;
             double dcintf = 20*scale ;
             double dc = 40*scale ;
            */
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            if (scale == 0 && sl_ <= 67)
            {
                scale = 4;
            }
            else if (scale == 0 && 67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (scale == 0 && 75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            //else
            //{
            //    scale = 1;
            //}

            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dhub = Convert.ToDouble(data["dhub"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double lf = Convert.ToDouble(data["lf"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double dcintf = Convert.ToDouble(data["dcintf"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;

            double fha = Convert.ToDouble(data["fha"]);
            //double fha = 15;
            double fha_ = fha * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dhub / 2.0 - dhub / 20.0);
            Vector2 p2 = fun.Polar(p1, pi / 4, dhub / 20.0);
            Vector2 p3 = fun.Polar(p2, 0, oal / 3.0 - dhub / 20.0) ;
            Vector2 p4 = fun.Polar(p3, pi / 4, oal / 20.0);
            Vector2 p5 = fun.Polar(p4, 0, oal / 3.0 * 2);
            Vector2 p6 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p7 = fun.mirrorpoint(p2, p0_1, p0_2);
            Vector2 p8= fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p9= fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p10= fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p11 = fun.Polar(p10, pi / 2, (dhub - dconms) / 2.0);
            Vector2 p12_ = fun.Polar(p10, pi / 2, oal);
            Vector2 p12 = fun.Inters(p10, p12_, p0_1, p0_2);
            Vector2 p13_1 = fun.Polar(p8, pi / 2, oal);
            Vector2 p13_2 = fun.Polar(p12, pi + fha_, oal); 
            Vector2 p13 = fun.Inters(p12, p13_2, p8, p13_1);
            Vector2 p14 = fun.Polar(p13, pi / -2 + fha_, Math.Sqrt((Math.Pow(0.3637 / 21.2336 * oal, 2) + Math.Pow(1.3923 / 17.655 * dhub, 2))));
            Vector2 p15_1 = fun.Polar(p12, pi / -2 - fha_, oal);
            Vector2 p15_2 = fun.Polar(p14, fha_, oal);
            Vector2 p15 = fun.Inters(p14, p15_2, p12, p15_1);
            Vector2 p16 = fun.Polar(p13, fun.CalAngle(p13, p14), fun.CalDistance(p13, p14) / 2.0);
            Vector2 p17= fun.Polar(p12, fun.CalAngle(p12, p15), fun.CalDistance(p12, p15) / 2.0);
            Vector2 p18_1 = fun.Polar(p8, pi / 2, -(p9.Y - p8.Y)*2);
            Vector2 p18_2 = fun.Polar(p18_1, 0, oal);
            Vector2 p18_3 = fun.Polar(p12, pi / -2 - fha_, oal);
            Vector2 p18 = fun.Inters(p18_1, p18_2, p12, p18_3);
            Vector2 p19 = fun.Polar(p10, pi, fun.CalDistance(p9, p10) / 3.0);
            Vector2 p20_1 = fun.Polar(p18, pi + fha_, oal);
            Vector2 p20_2 = fun.Polar(p19, pi / 2 - fha_, oal);
            Vector2 p20 = fun.Inters(p19, p20_2, p18, p20_1);
            Vector2 p21 = fun.Polar(p7, 0, fun.CalDistance(p7, p8) / 2.0);
            Vector2 p22_1 = fun.Polar(p1, 0, oal);
            Vector2 p22_2 = fun.Polar(p3, pi / -2, oal);
            Vector2 p22 = fun.Inters(p1, p22_1, p3, p22_2);
            Vector2 p23 = fun.Polar(p2, 0, fun.CalDistance(p2, p3) / 2.0);
            Vector2 p24 = fun.Polar(p22, pi / -2 + fha_, Math.Sqrt((Math.Pow(0.3637 / 21.2336 * oal, 2) + Math.Pow(1.3923 / 17.655 * dhub, 2))));
            Vector2 p25_ = fun.Polar(p24, fha_, oal);
            Vector2 p25 = fun.Inters(p24, p25_, p4, p5);
            Vector2 p26_ = fun.Polar(p22, fha_, oal);
            Vector2 p26 = fun.Inters(p22, p26_, p4, p5);
            Vector2 p27 = fun.Polar(p26, 0, fun.CalDistance(p26, p25) / 2.0);
            Vector2 p28 = fun.Polar(p22, pi / -2 + fha_, fun.CalDistance(p22, p24) / 2.0);
            Vector2 p29_1 = fun.Polar(p25, pi + fha_, oal);
            Vector2 p29_2 = fun.Polar(p22, pi / -2, oal);
            Vector2 p29 = fun.Inters(p25, p29_1, p22, p29_2);
            Vector2 p30_ = fun.Polar(p11, pi, oal);
            Vector2 p30 = fun.Inters(p11, p30_, p15, p18);
            Vector2 p31_ = fun.Polar(p15, pi, oal);
            Vector2 p31 = fun.Inters(p15, p31_, p12, p13);
            Vector2 p32_1 = fun.Polar(p12, fun.CalAngle(p12, p17), fun.CalDistance(p12, p17));
            Vector2 p32_2 = fun.Polar(p32_1, pi, oal);
            Vector2 p32 = fun.Inters(p32_1, p32_2, p12, p13);
            Vector2 p33 = fun.Polar(p17, pi / 2, fun.CalDistance(p5, p17) / 2.5) ;
            Vector2 p34_1 = fun.Polar(p32, pi / 2, oal);
            Vector2 p34_2 = fun.Polar(p33, pi + fha_, oal);
            Vector2 p34 = fun.Inters(p32, p34_1, p33, p34_2);
            Arc arc1 = fun.DrawArc4(p34, fun.CalDistance(p31, p34) / 2.0, p31, 0);
            Vector2 p35_ = fun.Polar(p5, pi / -2 - fha_*2, oal);
            Vector2 p35 = fun.Inters1(p5, p35_, arc1, 1);
            Vector2 p35_1 = fun.Polar(p5, pi, 0.1);
            Vector2 p35_2 = fun.Polar(p35_1, pi / -2 - fha_*3, oal);
            Vector2 p36_ = fun.Polar(p13, pi - pi / 4, oal);
            Vector2 p36 = fun.Inters(p13, p36_, p0_1, p0_2);
            Vector2 p37 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p37_ = fun.Polar(p37, 0, oal);
            Vector2 p38 = fun.Inters(p37, p37_, p5, p10);
            Vector2 p39_ = fun.Polar(p11, pi , oal);
            Vector2 p39 = fun.Inters(p11, p39_, p1, p6);

            Vector2 p49 = fun.Polar(p12, 0,  dc * 2);
            Vector2 p50 = fun.Polar(p49, pi / 2, dc / 2.0);
            Vector2 p51 = fun.Polar(p50, 0, dc / 2.0);
            Vector2 p52 = fun.Polar(p50, pi / 2, dc / 4.0);
            Vector2 p53 = fun.Polar(p52, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54 = fun.Polar(p53, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55 = fun.Polar(p54, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56 = fun.Polar(p55, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57 = fun.Polar(p56, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58 = fun.mirrorpoint(p50, p0_1, p0_2);
            Vector2 p59 = fun.mirrorpoint(p51, p0_1, p0_2);
            Vector2 p60 = fun.mirrorpoint(p52, p0_1, p0_2);
            Vector2 p61 = fun.mirrorpoint(p53, p0_1, p0_2);
            Vector2 p62 = fun.mirrorpoint(p54, p0_1, p0_2);
            Vector2 p63 = fun.mirrorpoint(p55, p0_1, p0_2);
            Vector2 p64 = fun.mirrorpoint(p56, p0_1, p0_2);
            Vector2 p65 = fun.mirrorpoint(p57, p0_1, p0_2);

            Line line1 = new Line(p35_1, p35_2);
            Arc arc2 = fun.DrawArc5(p5, line1, p35);
            Vector2 p33_1 = fun.Polar(p33, pi / 2, 0.1);
            Vector2 p33_2 = fun.Polar(p33_1, pi + fha_ / 3, oal) ;
            Vector2 p34_3 = fun.Polar(p34, pi, 0.01);
            Vector2 p34_4 = fun.Polar(p34_3, pi + fha_*3, oal);
            Vector2 p22_3 = fun.Polar(p22, pi / -2, 0.1);
            Vector2 p22_4 = fun.Polar(p22_3, fun.CalAngle(p22, p23) + fha_ , oal);
            Vector2 p14_3 = fun.Polar(p14, fun.CalAngle(p14, p21) - pi/2,0.1);
            Vector2 p14_4 = fun.Polar(p14_3, fun.CalAngle(p14, p21) - fha_*1.5, oal);
            Vector2 p13_3 = fun.Polar(p13, pi / -2, 0.1);
            Vector2 p13_4 = fun.Polar(p13_3, pi+fha_/3.0 , oal);
            Vector2 p29_3 = fun.Polar(p29, fun .CalAngle (p29,p36)-pi/2 , 0.1);
            Vector2 p29_4 = fun.Polar(p29_3, pi + fha_*3, oal);
            Vector2 p19_3 = fun.Polar(p19, fun .CalAngle (p19,p20)+pi/2, 0.1);
            Vector2 p19_4 = fun.Polar(p19_3, fun.CalAngle(p19, p20) + fha_ * 3, oal) ;

            Line line2 = new Line(p33_1, p33_2);
            Line line3 = new Line(p34_3, p34_4);
            Line line4 = new Line(p22_3, p22_4);
            Line line5 = new Line(p14_3, p14_4);
            Line line6 = new Line(p13_3, p13_4);
            Line line7 = new Line(p29_3, p29_4);
            Line line8 = new Line(p19_3, p19_4);
            Arc arc3 = fun.DrawArc5(p33, line2, p34);
            Arc arc4 = fun.DrawArc5(p34, line3, p32);
            Arc arc5 = fun.DrawArc5(p23, line4, p22);
            Arc arc6 = fun.DrawArc5(p14, line5, p21);
            Arc arc7 = fun.DrawArc5(p36, line6, p13);
            Arc arc8 = fun.DrawArc5(p29, line7, p36);
            Arc arc9 = fun.DrawArc5(p20, line8, p19);
            var polyline1 = Pus.AddPointsToLwPolyLine(p33, p5,p25,p29,p24,p28,p27,p25,p26,p22,p28,p27, p4, p3, p2, p1, p6, p7,p2,p7,
            p8, p9, p10, p11, p30,p18, p20, p18, p12, p13, p14, p15, p17, p16) ;
            var polyline2 = Pus.AddPointsToLwPolyLine(p50, p52, p53, p54, p55, p56, p57, p51, p50);
            var polyline3 = Pus.AddPointsToLwPolyLine(p58, p60, p61, p62, p63, p64, p65, p59, p58);
            /*dxf.AddEntity(new EntityObject[] { polyline1,polyline2 ,polyline3 
            ,arc1,arc2,arc3,arc4,arc5,arc6,arc7,arc8,arc9}) ;*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);

            Line line9 = new Line(p37,p38);
            line9.Lineweight = Lineweight.W35;//Lineweight指线宽
            line9.Layer = refin;//Layer指图层
            line9.LinetypeScale = 2 ;//指线性比例
            line9.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line9); //提取

            Line line10 = new Line(p39, p11);
            line10.Lineweight = Lineweight.W35;//Lineweight指线宽
            line10.Layer = refin;//Layer指图层
            line10.LinetypeScale = 2;//指线性比例
            line10.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line10); //提取

            Line line11 = new Line(p0_1 , p0_2);
            line11.Lineweight = Lineweight.W25;//Lineweight指线宽
            line11.Layer = center;//Layer指图层
            line11.LinetypeScale = 2;//指线性比例
            line11.Linetype = Linetype.DashDot ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line11); //提取



            //标注
            Vector2 v1 = fun.Polar(p37, pi, dc / 6.0);
            Vector2 v2 = fun.Polar(v1, pi / 2 - 5 * pi / 180, dhub / 3.5);
            Vector2 v3 = fun.Polar(v2, pi / 2 - 5 * pi / 180, dhub / 3.5);
            Vector2 v4 = fun.Polar(p0, pi + pi / 4, dconms*2);
            Vector2 v5 = fun.Polar(p12, pi / -3, 1.7 * 0.5 * scale);
            Vector2 v6 = fun.Polar(v5, pi / -3, dc);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            Vector2 v8 = fun.Polar(p10, pi / -3, 1.7 * 0.5 * scale);
            Vector2 v9 = fun.Polar(v8, pi / -3, dc/2.0);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p0, pi + pi / 3, 1.7 * 0.5 * scale);
            Vector2 v12 = fun.Polar(v11, pi + pi / 3, dc/1.6);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            fun.dimrot1(dxf, p1, p5, 0, dc /4.0, 2, 1.5*scale  , 1.9*scale , 0.9, "OAL,LPR="+oal/scale , "", "");
            fun.dimrot1(dxf, p38, p11, -90, dc , 2, 1.5 * scale, 1.9 * scale, 0.9, "DCINTF="+dcintf /scale , "", "");
            fun.dimrot1(dxf, p5, p10, -90, dc*1.2 , 2, 1.5 * scale, 1.9 * scale, 0.9, "DC="+dc/scale , "", "");
            fun.dimrot1(dxf, p21, p10, 180, dc / 4.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "LCF="+lcf/scale , "", "");
            fun.dimrot1(dxf, p6, p10, 180, dc / 2.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "LF="+lf/scale , "", "");
            fun.dimrot1(dxf, p37, p39, 90, dc / 4.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "DCONMS="+dconms/scale , "", "");
            fun.dimrot1(dxf, p2, p7, 90, dc / 2.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "DHUB="+dhub/scale , "", "");
            fun.dimrot1(dxf, p51, p59, 90, dc / 8.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line(p12, fun .Polar (p12,0,0.1)), new Line(p12, fun .Polar (p12,fha_,0.1)), dc / 1.3, 1.5 * scale, 1.9 * scale, 0.9, "FHA", "", "");
            fun.jdbz2(dxf, new Line(p12, fun.Polar(p12, pi / -2 + 0.01 * pi / 180, 0.1)), new Line(p12, fun.Polar(p12, pi/2, 0.1)), dc *1.5, 1.5 * scale, 1.9 * scale, 0.9, "SIG", "", "");
            fun.Singlelinearrow(dxf, "CCMS", v1, 85, v2, v3, 1.5 * scale, 1.9 * scale);
            fun.Axis(dxf, v4, 180, -90, "Z", "X", "Y", 0.5*scale , 1.5 * scale, 0);  
            fun.Axis(dxf, p0 ,180, -90, " ", " ", " ", 0.5*scale , 1.5 * scale, 0);  
            fun.Axis(dxf, p12, 180, -90, " ", " ", " ", 0.5*scale , 1.5 * scale, 0);
            Line linev1 = new Line(v5, v6);
            Line linev2 = new Line(v8, v9);
            Line linev3 = new Line(v11, v12);
            Text txt1 = new Text("CIP", v7, 1.5 * scale, 0);
            Text txt2 = new Text("CRP", v10, 1.5 * scale, 0);
            Text txt3 = new Text("PCS,MCS", v13, 1.5 * scale, 0);
            Circle circle1 = new Circle(Pus.ToV3(p10, 0), 1.7 * 0.5 * scale); 
            dxf.AddEntity(new EntityObject[] { txt1 ,txt2,txt3
            ,linev1 ,linev2,linev3
            ,circle1 
            }) ;


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);

            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }





            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ISYC_302_09(Dictionary<string, Object> data)  //  整体套式平底锪钻头
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
           
            /* double sl_ = 120;
             double scale = 1;
             if (sl_ <= 67)
             {
                 scale = 4;
             }
             else if (67 < sl_ && sl_ <= 75)
             {
                 scale = 2.5;
             }
             else if (75 < sl_ && sl_ <= 100)
             {
                 scale = 2;
             }
             else
             {
                 scale = 1;
             }

             double dconms = 20*scale ;
             double dhub = 36*scale ;
             double oal = 40*scale ;
             double lf = 40*scale ;
             double lcf = 36*scale ;
             double dcintf = 20*scale ;
             double dc = 40*scale ;
            */
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }

            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dhub = Convert.ToDouble(data["dhub"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double lf = Convert.ToDouble(data["lf"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double dcintf = Convert.ToDouble(data["dcintf"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;
            
            double fha = Convert.ToDouble(data["fha"]);
           // double fha = 15;
            double fha_ = fha * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dhub / 2.0 - dhub / 20.0);
            Vector2 p2 = fun.Polar(p1, pi / 4, dhub / 20.0);
            Vector2 p3 = fun.Polar(p2, 0, oal / 3.0 - dhub / 20.0);
            Vector2 p4 = fun.Polar(p3, pi / 4, oal / 20.0);
            Vector2 p5 = fun.Polar(p4, 0, oal / 3.0 * 2);
            Vector2 p6 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p7 = fun.mirrorpoint(p2, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p9 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p10 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p11 = fun.Polar(p10, pi / 2, (dhub - dconms) / 2.0);
            Vector2 p12_ = fun.Polar(p10, pi / 2, oal);
            Vector2 p12 = fun.Inters(p10, p12_, p0_1, p0_2);
            Vector2 p13_1 = fun.Polar(p8, pi / 2, oal);
            Vector2 p13_2 = fun.Polar(p12, pi + fha_, oal);
            Vector2 p13 = fun.Inters(p12, p13_2, p8, p13_1);
            Vector2 p14 = fun.Polar(p13, pi / -2 + fha_, Math.Sqrt((Math.Pow(0.3637 / 21.2336 * oal, 2) + Math.Pow(1.3923 / 17.655 * dhub, 2))));
            Vector2 p15_1 = fun.Polar(p12, pi / -2 - fha_, oal);
            Vector2 p15_2 = fun.Polar(p14, fha_, oal);
            Vector2 p15 = fun.Inters(p14, p15_2, p12, p15_1);
            Vector2 p16 = fun.Polar(p13, fun.CalAngle(p13, p14), fun.CalDistance(p13, p14) / 2.0);
            Vector2 p17 = fun.Polar(p12, fun.CalAngle(p12, p15), fun.CalDistance(p12, p15) / 2.0);
            Vector2 p18_1 = fun.Polar(p8, pi / 2, -(p9.Y - p8.Y) * 2);
            Vector2 p18_2 = fun.Polar(p18_1, 0, oal);
            Vector2 p18_3 = fun.Polar(p12, pi / -2 - fha_, oal);
            Vector2 p18 = fun.Inters(p18_1, p18_2, p12, p18_3);
            Vector2 p19 = fun.Polar(p10, pi, fun.CalDistance(p9, p10) / 3.0);
            Vector2 p20_1 = fun.Polar(p18, pi + fha_, oal);
            Vector2 p20_2 = fun.Polar(p19, pi / 2 - fha_, oal);
            Vector2 p20 = fun.Inters(p19, p20_2, p18, p20_1);
            Vector2 p21 = fun.Polar(p7, 0, fun.CalDistance(p7, p8) / 2.0);
            Vector2 p22_1 = fun.Polar(p1, 0, oal);
            Vector2 p22_2 = fun.Polar(p3, pi / -2, oal);
            Vector2 p22 = fun.Inters(p1, p22_1, p3, p22_2);
            Vector2 p23 = fun.Polar(p2, 0, fun.CalDistance(p2, p3) / 2.0);
            Vector2 p24 = fun.Polar(p22, pi / -2 + fha_, Math.Sqrt((Math.Pow(0.3637 / 21.2336 * oal, 2) + Math.Pow(1.3923 / 17.655 * dhub, 2))));
            Vector2 p25_ = fun.Polar(p24, fha_, oal);
            Vector2 p25 = fun.Inters(p24, p25_, p4, p5);
            Vector2 p26_ = fun.Polar(p22, fha_, oal);
            Vector2 p26 = fun.Inters(p22, p26_, p4, p5);
            Vector2 p27 = fun.Polar(p26, 0, fun.CalDistance(p26, p25) / 2.0);
            Vector2 p28 = fun.Polar(p22, pi / -2 + fha_, fun.CalDistance(p22, p24) / 2.0);
            Vector2 p29_1 = fun.Polar(p25, pi + fha_, oal);
            Vector2 p29_2 = fun.Polar(p22, pi / -2, oal);
            Vector2 p29 = fun.Inters(p25, p29_1, p22, p29_2);
            Vector2 p30_ = fun.Polar(p11, pi, oal);
            Vector2 p30 = fun.Inters(p11, p30_, p15, p18);
            Vector2 p31_ = fun.Polar(p15, pi, oal);
            Vector2 p31 = fun.Inters(p15, p31_, p12, p13);
            Vector2 p32_1 = fun.Polar(p12, fun.CalAngle(p12, p17), fun.CalDistance(p12, p17));
            Vector2 p32_2 = fun.Polar(p32_1, pi, oal);
            Vector2 p32 = fun.Inters(p32_1, p32_2, p12, p13);
            Vector2 p33 = fun.Polar(p17, pi / 2, fun.CalDistance(p5, p17) / 2.5);
            Vector2 p34_1 = fun.Polar(p32, pi / 2, oal);
            Vector2 p34_2 = fun.Polar(p33, pi + fha_, oal);
            Vector2 p34 = fun.Inters(p32, p34_1, p33, p34_2);
            Arc arc1 = fun.DrawArc4(p34, fun.CalDistance(p31, p34) / 2.0, p31, 0);
            Vector2 p35_ = fun.Polar(p5, pi / -2 - fha_ * 2, oal);
            Vector2 p35 = fun.Inters1(p5, p35_, arc1, 1);
            Vector2 p35_1 = fun.Polar(p5, pi, 0.1);
            Vector2 p35_2 = fun.Polar(p35_1, pi / -2 - fha_ * 3, oal);
            Vector2 p36_ = fun.Polar(p13, pi - pi / 4, oal);
            Vector2 p36 = fun.Inters(p13, p36_, p0_1, p0_2);
            Vector2 p37 = fun.Polar(p0, pi / 2, dhub  / 6*2);
            Vector2 p37_ = fun.Polar(p37, 0, oal);
            Vector2 p38 = fun.Inters(p37, p37_, p5, p10);
            Vector2 p39 = fun.mirrorpoint(p37, p0_1, p0_2);
            Vector2 p40_ = fun.Polar(p37, 0, oal);
            Vector2 p40 = fun.Inters(p37, p40_, p4, p9);
            Vector2 p41 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p42_ = fun.Polar(p33, pi, oal);
            Vector2 p42 = fun.Inters(p33, p42_, p25, fun.Polar(p25, pi / -2, oal));
            Vector2 p43 = fun.Inters(p11, fun.Polar(p11, pi, oal), p25, fun.Polar(p25, pi / -2, oal));
            Vector2 p44 = fun.Polar(p42, pi / -2, fun.CalDistance(p42, p43) / 5.0);
            Vector2 p45 = fun.Polar(p43, pi / 2, fun.CalDistance(p42, p43) / 5.0);
            Vector2 p46_ = fun.Polar(p44, pi , oal);
            Vector2 p47_ = fun.Polar(p45, pi , oal);
            Vector2 p46 = fun.Inters (p44, p46_, p40, p41);
            Vector2 p47 = fun.Inters (p45, p47_, p40, p41);


            Vector2 p49 = fun.Polar(p12, 0, dc * 2);
            Vector2 p50 = fun.Polar(p49, pi / 2, dc / 2.0);
            Vector2 p51 = fun.Polar(p50, 0, dc / 2.0);
            Vector2 p52 = fun.Polar(p50, pi / 2, dc / 4.0);
            Vector2 p53 = fun.Polar(p52, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54 = fun.Polar(p53, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55 = fun.Polar(p54, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56 = fun.Polar(p55, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57 = fun.Polar(p56, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58 = fun.mirrorpoint(p50, p0_1, p0_2);
            Vector2 p59 = fun.mirrorpoint(p51, p0_1, p0_2);
            Vector2 p60 = fun.mirrorpoint(p52, p0_1, p0_2);
            Vector2 p61 = fun.mirrorpoint(p53, p0_1, p0_2);
            Vector2 p62 = fun.mirrorpoint(p54, p0_1, p0_2);
            Vector2 p63 = fun.mirrorpoint(p55, p0_1, p0_2);
            Vector2 p64 = fun.mirrorpoint(p56, p0_1, p0_2);
            Vector2 p65 = fun.mirrorpoint(p57, p0_1, p0_2);

            Line line1 = new Line(p35_1, p35_2);
            Arc arc2 = fun.DrawArc5(p5, line1, p35);
            Vector2 p33_1 = fun.Polar(p33, pi / 2, 0.1);
            Vector2 p33_2 = fun.Polar(p33_1, pi + fha_ / 3, oal);
            Vector2 p34_3 = fun.Polar(p34, pi, 0.01);
            Vector2 p34_4 = fun.Polar(p34_3, pi + fha_ * 3, oal);
            Vector2 p22_3 = fun.Polar(p22, pi / -2, 0.1);
            Vector2 p22_4 = fun.Polar(p22_3, fun.CalAngle(p22, p23) + fha_, oal);
            Vector2 p14_3 = fun.Polar(p14, fun.CalAngle(p14, p21) - pi / 2, 0.1);
            Vector2 p14_4 = fun.Polar(p14_3, fun.CalAngle(p14, p21) - fha_ * 1.5, oal);
            Vector2 p13_3 = fun.Polar(p13, pi / -2, 0.1);
            Vector2 p13_4 = fun.Polar(p13_3, pi + fha_ / 3.0, oal);
            Vector2 p29_3 = fun.Polar(p29, fun.CalAngle(p29, p36) - pi / 2, 0.1);
            Vector2 p29_4 = fun.Polar(p29_3, pi + fha_ * 3, oal);
            Vector2 p19_3 = fun.Polar(p19, fun.CalAngle(p19, p20) + pi / 2, 0.1);
            Vector2 p19_4 = fun.Polar(p19_3, fun.CalAngle(p19, p20) + fha_ * 3, oal);

            Line line2 = new Line(p33_1, p33_2);
            Line line3 = new Line(p34_3, p34_4);
            Line line4 = new Line(p22_3, p22_4);
            Line line5 = new Line(p14_3, p14_4);
            Line line6 = new Line(p13_3, p13_4);
            Line line7 = new Line(p29_3, p29_4);
            Line line8 = new Line(p19_3, p19_4);
            Arc arc3 = fun.DrawArc5(p33, line2, p34);
            Arc arc4 = fun.DrawArc5(p34, line3, p32);
            Arc arc5 = fun.DrawArc5(p23, line4, p22);
            Arc arc6 = fun.DrawArc5(p14, line5, p21);
            Arc arc7 = fun.DrawArc5(p36, line6, p13);
            Arc arc8 = fun.DrawArc5(p29, line7, p36);
            Arc arc9 = fun.DrawArc5(p20, line8, p19);
            var polyline1 = Pus.AddPointsToLwPolyLine(p33, p5, p25, p29, p25, p26, p22, p26, p4, p3, p2, p1, p6, p7, p2, p7,
            p8, p9, p10, p11, p30, p18, p20, p18, p12, p13, p14, p15, p17, p16);
           
            /*dxf.AddEntity(new EntityObject[] { polyline1,polyline2 ,polyline3 
            ,arc1,arc2,arc3,arc4,arc5,arc6,arc7,arc8,arc9}) ;*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            //fun.PolyFill(dxf, polyline2, 0.5, contour);
            //fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);

            Line line9 = new Line(p37, p40);
            line9.Lineweight = Lineweight.W35;//Lineweight指线宽
            line9.Layer = refin;//Layer指图层
            line9.LinetypeScale = 2;//指线性比例
            line9.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line9); //提取

            Line line10 = new Line(p39, p41);
            line10.Lineweight = Lineweight.W35;//Lineweight指线宽
            line10.Layer = refin;//Layer指图层
            line10.LinetypeScale = 2;//指线性比例
            line10.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line10); //提取

            Line line11 = new Line(p0_1, p0_2);
            line11.Lineweight = Lineweight.W25;//Lineweight指线宽
            line11.Layer = centre;//Layer指图层
            line11.LinetypeScale = 5;//指线性比例
            line11.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line11); //提取

            Line line12 = new Line(p40, p41);
            line12.Lineweight = Lineweight.W35;//Lineweight指线宽
            line12.Layer = refin;//Layer指图层
            line12.LinetypeScale = 2;//指线性比例
            line12.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line12); //提取

            Line line13 = new Line(p44, p46);
            line13.Lineweight = Lineweight.W35;//Lineweight指线宽
            line13.Layer = refin;//Layer指图层
            line13.LinetypeScale = 2;//指线性比例
            line13.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line13); //提取

            Line line14 = new Line(p45, p47);
            line14.Lineweight = Lineweight.W35;//Lineweight指线宽
            line14.Layer = refin;//Layer指图层
            line14.LinetypeScale = 2;//指线性比例
            line14.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line14); //提取

            Line line15 = new Line(p42, p43);
            line15.Lineweight = Lineweight.W35;//Lineweight指线宽
            line15.Layer = refin;//Layer指图层
            line15.LinetypeScale = 2;//指线性比例
            line15.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line15); //提取

            Line line16 = new Line(p42, p33);
            line16.Lineweight = Lineweight.W35;//Lineweight指线宽
            line16.Layer = refin;//Layer指图层
            line16.LinetypeScale = 2;//指线性比例
            line16.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line16); //提取


            Line line17 = new Line(p43, p11);
            line17.Lineweight = Lineweight.W35;//Lineweight指线宽
            line17.Layer = refin;//Layer指图层
            line17.LinetypeScale = 2;//指线性比例
            line17.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line17); //提取
            //标注
            Vector2 v1 = fun.Polar(p37, pi, dc / 6.0);
            Vector2 v2 = fun.Polar(v1, pi / 2 - 5 * pi / 180, dhub / 3.5);
            Vector2 v3 = fun.Polar(v2, pi / 2 - 5 * pi / 180, dhub / 3.5);
            Vector2 v4 = fun.Polar(p0, pi + pi / 4, dconms * 2);

            Vector2 v5 = fun.Polar(p12, pi / -3, 1.7 * 0.5 * scale);
            Vector2 v6 = fun.Polar(v5, pi / -3, dc);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            Vector2 v8 = fun.Polar(p10, pi / -3, 1.7 * 0.5 * scale);
            Vector2 v9 = fun.Polar(v8, pi / -3, dc / 2.0);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p0, pi + pi / 3, 1.7 * 0.5 * scale);
            Vector2 v12 = fun.Polar(v11, pi + pi / 3, dc / 1.6);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            fun.dimrot1(dxf, p1, p5, 0, dc / 2.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "OAL,LPR", "", "");
            fun.dimrot1(dxf, p29, p5, 0, dc / 4.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p38, p11, -90, dc, 2, 1.5 * scale, 1.9 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p5, p10, -90, dc * 1.2, 2, 1.5 * scale, 1.9 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p21, p10, 180, dc / 4.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "LCF", "", "");
            fun.dimrot1(dxf, p6, p10, 180, dc / 2.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "LF", "", "");
            fun.dimrot1(dxf, p37, p39, 90, dc / 4.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "DCB", "", "");
            fun.dimrot1(dxf, p2, p7, 90, dc / 2.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "DF", "", "");
            //fun.dimrot1(dxf, p51, p59, 90, dc / 8.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line(p12, fun.Polar(p12, 0, 0.1)), new Line(p12, fun.Polar(p12, fha_, 0.1)), dc / 1.3, 1.5 * scale, 1.9 * scale, 0.9, "FHA", "", "");
            //fun.jdbz2(dxf, new Line(p12, fun.Polar(p12, pi / -2 + 0.01 * pi / 180, 0.1)), new Line(p12, fun.Polar(p12, pi / 2, 0.1)), dc * 1.5, 1.5 * scale, 1.9 * scale, 0.9, "SIG", "", "");
          /*  fun.Singlelinearrow(dxf, "CCMS", v1, 85, v2, v3, 1.5 * scale, 1.9 * scale);
            fun.Axis(dxf, v4, 180, -90, "Z", "X", "Y", 0.5 * scale, 1.5 * scale, 0);
            fun.Axis(dxf, p0, 180, -90, " ", " ", " ", 0.5 * scale, 1.5 * scale, 0);
            fun.Axis(dxf, p12, 180, -90, " ", " ", " ", 0.5 * scale, 1.5 * scale, 0);*/
            Line linev1 = new Line(v5, v6);
            Line linev2 = new Line(v8, v9);
            Line linev3 = new Line(v11, v12);
            Text txt1 = new Text("CIP", v7, 1.5 * scale, 0);
            Text txt2 = new Text("CRP", v10, 1.5 * scale, 0);
            Text txt3 = new Text("PCS,MCS", v13, 1.5 * scale, 0);
            Circle circle1 = new Circle(Pus.ToV3(p10, 0), 1.7 * 0.5 * scale);
            /* dxf.AddEntity(new EntityObject[] { txt1 ,txt2,txt3
             ,linev1 ,linev2,linev3
             ,circle1
             });*/

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void Wholeconecountersunking1(Dictionary<string, Object> data)  //  整体套式锥面锪钻
        {
            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            
            /*
             double sl_ = 120;
             double scale = 1;*/
             if (sl_ <= 67)
             {
                 scale = 4;
             }
             else if (67 < sl_ && sl_ <= 75)
             {
                 scale = 2.5;
             }
             else if (75 < sl_ && sl_ <= 100)
             {
                 scale = 2;
             }
             else
             {
                 scale = 1;
             }
            /*
           double dconms = 20*scale ;
           double dc = 30 * scale;
           double dcx = 60 * scale;
           double oal = 45 * scale;
           double ta = 90 * scale;
           double ta_ = ta * pi / 180;*/
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double dcx = Convert.ToDouble(data["dcx"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;           
            double ta = Convert.ToDouble(data["ta"]) ;
            double ta_ = ta * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p2 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p3 = fun.Polar(p0, pi / 2, dcx / 2.0);
           
            Vector2 p5 = fun.Polar(p2, 0, oal) ;
            Vector2 p4 = fun.Inters(p5, fun.Polar(p5, pi / 2 + (pi / 2 - ta_/2.0), oal), p3, fun.Polar(p3, 0, oal));
            Vector2 p6 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p7 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p9 = fun.Inters(p4, p3, p5, fun.Polar(p5, pi/2+(pi / 2 - ta_/2.0) +4*pi/180, oal ));
            Vector2 p10 = fun.Polar(p1, pi / 2, fun.CalDistance(p2, p1) / 2.0);
            Vector2 p11_1 = fun.Polar(p1, 0, oal);
            Vector2 p11_2 = fun.Polar (p10, pi / -4, oal);
            Vector2 p11 = fun.Inters(p10, p11_2, p1, p11_1);
            Vector2 p12_ = fun.Polar(p5, pi + pi / 4, oal);
            Vector2 p12 = fun.Inters(p5, p12_, p1, p11_1);
            Vector2 p13_ = fun.Polar(p11, pi / -2, oal);
            Vector2 p14_ = fun.Polar(p12, pi / -2, oal);
            Vector2 p13 = fun.Inters(p11, p13_, p0_1, p0_2);
            Vector2 p14 = fun.Inters(p12, p14_, p0_1, p0_2);
            Vector2 p15 = fun.mirrorpoint(p11, p0_1, p0_2);
            Vector2 p16 = fun.mirrorpoint(p12, p0_1, p0_2);
            Vector2 p17 = fun.mirrorpoint(p10, p0_1, p0_2);
            Vector2 p18 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p19 = fun.Inters(p0, fun.Polar(p0, 0, oal), p5, p8);
            Vector2 p20_1 = fun.Polar(p0, pi / -2, dcx / 50.0);
            Vector2 p20_2 = fun.Polar(p20_1, 0, oal);
            Vector2 p20 = fun.Inters(p4, p7, p20_1, p20_2);
            Vector2 p21 = fun.Inters(p4, p7, p18, p16);
            Vector2 p22_1 = fun.Polar(p20, pi + pi / 4, oal);
            Vector2 p22_2 = fun.Polar(p18, pi / 2, fun.CalDistance(p18, p0) / 3.0);
            Vector2 p22_3 = fun.Polar(p22_2, 0, oal);
            Vector2 p22 = fun.Inters(p20, p22_1, p22_2, p22_3);
            Vector2 p23_1 = fun.Polar(p20, pi / -3, oal);
            Vector2 p23_2 = fun.Polar(p22, 0, oal);
            Vector2 p23 = fun.Inters(p20, p23_1, p22, p23_2);
            Vector2 p24_1 = fun.Polar(p19, pi, 0.5);
            Vector2 p24_2 = fun.Polar(p24_1, pi / -2-5*pi/180, oal);
            Line line5 = new Line(p24_1, p24_2);
            Arc arc1 = fun.DrawArc5(p19, line5, p8);
            Vector2 p24_3 = fun.Polar(p23, 20*pi/180, oal);
            Vector2 p24 = fun.Inters1(p23, p24_3, arc1, 0);
            Vector2 p25_ = fun.Polar(p20, 2.5 * pi / 180, oal);
            Vector2 p25 = fun.Inters1(p20, p25_, arc1, 0);
            Vector2 p26_ = fun.Polar(p21, 20 * pi / 180, oal);
            Vector2 p26 = fun.Inters1(p21, p26_, arc1, 0);
            Vector2 p27_ = fun.Polar(p18, pi / -2, (dcx - dconms) / 2.0 / 3.0) ;
            Vector2 p27 = fun.Polar(p22, pi / -2, Math.Abs(p27_.Y-p22.Y ));
            Vector2 p28_1 = fun.Polar(p27, 0, oal);
            Vector2 p28_2 = fun.Polar(p16, fun.CalAngle(p26, p21)+10*pi/180, oal);
            Vector2 p28 = fun.Inters(p27, p28_1, p16, p28_2);
            Vector2 p29_ = fun.Polar(p28, fun.CalAngle(p21, p26)+10*pi/180, oal);
            Vector2 p29 = fun.Inters1(p28, p29_, arc1, 0);
            Vector2 p30 = fun.Polar(p27, pi / -2, (dcx - dconms) / 2.0 / 3.0);
            Vector2 p31 = fun.Polar(p30, 0, fun.CalDistance(p27, p28));
            Vector2 p32_ = fun.Polar(p31, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p32 = fun.Inters1(p31, p32_, arc1, 0);
            Vector2 p33 = fun.Polar(p21, pi / -2, (dcx - dconms) / 2.0 / 3.0);
            Vector2 p34_ = fun.Polar(p33, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p34 = fun.Inters1(p33, p34_, arc1, 0);
            Vector2 p35_ = fun.Polar(p30, pi / -2, oal);
            Vector2 p35 = fun.Inters(p6, p7, p30, p35_);
            Vector2 p36_1 = fun.Polar(p35, fun.CalAngle(p30, p33), oal);
            Vector2 p36_2 = fun.Polar(p8, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p36 = fun.Inters(p35, p36_1, p8, p36_2);

            Vector2 p49 = fun.Polar(p12, 0, dc * 2);
            Vector2 p50 = fun.Polar(p49, pi / 2, dc / 2.0);
            Vector2 p51 = fun.Polar(p50, 0, dc / 2.0);
            Vector2 p52 = fun.Polar(p50, pi / 2, dc / 4.0);
            Vector2 p53 = fun.Polar(p52, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54 = fun.Polar(p53, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55 = fun.Polar(p54, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56 = fun.Polar(p55, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57 = fun.Polar(p56, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58 = fun.mirrorpoint(p50, p0_1, p0_2);
            Vector2 p59 = fun.mirrorpoint(p51, p0_1, p0_2);
            Vector2 p60 = fun.mirrorpoint(p52, p0_1, p0_2);
            Vector2 p61 = fun.mirrorpoint(p53, p0_1, p0_2);
            Vector2 p62 = fun.mirrorpoint(p54, p0_1, p0_2);
            Vector2 p63 = fun.mirrorpoint(p55, p0_1, p0_2);
            Vector2 p64 = fun.mirrorpoint(p56, p0_1, p0_2);
            Vector2 p65 = fun.mirrorpoint(p57, p0_1, p0_2);

            Line line6 = new Line(p20,p25);
            Line line7 = new Line(p23, p24);
            Line line8 = new Line(p22, p23);
            Line line9 = new Line(p26, p21);
            Line line10 = new Line(p27, p28);
            Line line11 = new Line(p28, p29);
            Line line12 = new Line(p34, p33);
            Line line13 = new Line(p32, p31);
            Line line14 = new Line(p30, p31);
            Line line15 = new Line(p8, p36);
            Line line16 = new Line(p36, p35);


            Arc arc2 = fun.DrawArc4(p25, arc1.Radius, p24, 0);
            Arc arc3 = fun.DrawArc4(p20, arc1.Radius, p22, 0);
            Arc arc4 = fun.DrawArc4(p26, arc1.Radius, p29, 0);
            Arc arc5 = fun.DrawArc4(p21, arc1.Radius, p27, 0);
            Arc arc6 = fun.DrawArc4(p34, arc1.Radius, p32, 0);
            Arc arc7 = fun.DrawArc4(p33, arc1.Radius, p30, 0);

            var polyline1 = Pus.AddPointsToLwPolyLine(p3, p4, p5, p8, p7, p6, p3, p9, p5, p2, p10, p11, p13, p11, p12, p14, p12, p5);
            var polyline2 = Pus.AddPointsToLwPolyLine(p3, p2, p5, p9, p3);

            var polyline3 = Pus.AddPointsToLwPolyLine(p50, p52, p53, p54, p55, p56, p57, p51, p50);
            var polyline4 = Pus.AddPointsToLwPolyLine(p58, p60, p61, p62, p63, p64, p65, p59, p58);
   
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);

            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline2.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline2.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline2.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 15*scale , hline1, harc1, hatching);
          /*  dxf.AddEntity(new EntityObject[] { polyline1 
                ,line6,line7,line8 ,line9,line10,line11,line12,line13,line14,line15,line16
            ,arc2,arc3,arc4,arc5,arc6,arc7
            });*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBline(dxf, line6, 0.5, contour);
            fun.drawBline(dxf, line7, 0.5, contour);
            fun.drawBline(dxf, line8, 0.5, contour);
            fun.drawBline(dxf, line9, 0.5, contour);
            fun.drawBline(dxf, line10, 0.5, contour);
            fun.drawBline(dxf, line11, 0.5, contour);
            fun.drawBline(dxf, line12, 0.5, contour);
            fun.drawBline(dxf, line13, 0.5, contour);
            fun.drawBline(dxf, line14, 0.5, contour);
            fun.drawBline(dxf, line15, 0.5, contour);
            fun.drawBline(dxf, line16, 0.5, contour);

            Line line1 = new Line(p0_1, p0_2);
            line1.Lineweight = Lineweight.W35;//Lineweight指线宽
            line1.Layer = center;//Layer指图层
            line1.LinetypeScale = 2;//指线性比例
            line1.Linetype = Linetype.DashDot ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line1); //提取

            Line line2 = new Line(p15, p16);
            line2.Lineweight = Lineweight.W35;//Lineweight指线宽
            line2.Layer = refin;//Layer指图层
            line2.LinetypeScale = 2;//指线性比例
            line2.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line2); //提取

            Line line3 = new Line(p13, p15);
            line3.Lineweight = Lineweight.W35;//Lineweight指线宽
            line3.Layer = refin;//Layer指图层
            line3.LinetypeScale = 2;//指线性比例
            line3.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line3); //提取

            Line line4 = new Line(p14, p16);
            line4.Lineweight = Lineweight.W35;//Lineweight指线宽
            line4.Layer = refin;//Layer指图层
            line4.LinetypeScale = 2;//指线性比例
            line4.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line4); //提取

            Line line17 = new Line(p15, p17);
            line17.Lineweight = Lineweight.W35;//Lineweight指线宽
            line17.Layer = refin;//Layer指图层
            line17.LinetypeScale = 2;//指线性比例
            line17.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line17); //提取

            Line line18 = new Line(p16, p8);
            line18.Lineweight = Lineweight.W35;//Lineweight指线宽
            line18.Layer = refin;//Layer指图层
            line18.LinetypeScale = 2;//指线性比例
            line18.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line18); //提取

            //标注
            Vector2 v1 = fun.Polar(p11, pi, dc /2.0);
            Vector2 v2 = fun.Polar(p5, pi / 6, dc*1.5);

            Vector2 v3  = fun.Polar(p19, pi / -4, 1.7 * 1 * scale);
            Vector2 v4 = fun.Polar(v3, pi / -4, dc);
            Vector2 v5 = fun.Polar(v4, pi / -2, 1.2 * scale);
            Vector2 v6 = fun.Polar(p8, pi / -3, 1.7 * 1 * scale);
            Vector2 v7 = fun.Polar(v6, pi / -3, dc);
            Vector2 v8 = fun.Polar(v7, pi / -2, 1.2 * scale);
            Vector2 v9 = fun.Polar(p0, pi + pi / 3, 1.7 * 1 * scale);
            Vector2 v10 = fun.Polar(v9, pi + pi / 3, dc*1.5);
            Vector2 v11 = fun.Polar(v10, pi / -2, 1.2 * scale);
            Vector2 v12 = fun.Polar(p3, pi / 2, dc * 1.7);
            fun.dimrot1(dxf, p3, p5 , 0, dc*1.5 , 2, 2 * scale, 2.4 * scale, 0.9, "OAL,LPR", "", "");
            fun.dimrot1(dxf, p4, p5, 0, dc, 2, 2 * scale, 2.4 * scale, 0.9, "TPL,PL", "", "");
            fun.dimrot1(dxf, p8, p5, -90, dc*2, 2, 2 * scale, 2.4 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p6, p8, 180, dc, 2, 2 * scale, 2.4 * scale, 0.9, "LF,LTA", "", "");
            fun.dimrot1(dxf, p3, p6, 90, dc*1.5, 2, 2 * scale, 2.4 * scale, 0.9, "DCX", "", "");
            fun.dimrot1(dxf, p1, p18, 90, dc, 2, 2 * scale, 2.4 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, p51, p59, 90, dc / 8.0, 2, 1.5 * scale, 1.9 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line(p4,p5), new Line(p7,p8 ), dc, 2 * scale, 2.4 * scale, 0.9, "TA", "", "");
            fun.Axis(dxf, fun.Polar(p0, pi + pi / 3, dc*2), 180, -90, "Z", "X", "Y", 1 * scale, 2 * scale, 0);
            fun.Axis(dxf, p0 , 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
            fun.Axis(dxf, p19 , 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v1, 110, fun.Polar(v1, 110 * pi / 180, dc / 2.0), fun.Polar(v1, 110 * pi / 180, dc), 2 * scale, 2.4 * scale);
            fun.Singlelinearrow(dxf, "FDP", v2, 0, fun.Polar(v2, pi, dc / 2.0), fun.Polar(v2,pi, dc), 2 * scale, 2.4 * scale);

            Line linev1 = new Line(v3, v4);
            Line linev2 = new Line(v6, v7);
            Line linev3 = new Line(v9, v10);
            Text txt1 = new Text("CIP", v5, 2 * scale, 0);
            Text txt2 = new Text("CRP", v8, 2 * scale, 0);
            Text txt3 = new Text("PCS,MCS", v11, 2 * scale, 0);
            Text txt4 = new Text("ISYC=302_10", v12, 2 * scale, 0);
            dxf.AddEntity(new EntityObject[] { linev1 ,linev2 ,linev3
            ,txt1 ,txt2 ,txt3,txt4
            });



            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);

            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ISYC_302_10(Dictionary<string, Object> data)  //  整体套式锥面锪钻
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            
            /*
            double sl_ = 45;
            double scale = 1;*/
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            /*
            double dconms = 20 * scale;
            double dc = 30 * scale;
            double dcx = 60 * scale;
            double oal = 45 * scale;
            double ta = 90 ;
            double ta_ = ta * pi / 180;*/
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double dcx = Convert.ToDouble(data["dcx"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;           
            double ta = Convert.ToDouble(data["ta"]) ;
            double ta_ = ta * pi / 180;
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p2 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p3 = fun.Polar(p0, pi / 2, dcx / 2.0);

            Vector2 p5 = fun.Polar(p2, 0, oal);
            Vector2 p4 = fun.Inters(p5, fun.Polar(p5, pi / 2 + (pi / 2 - ta_ / 2.0), oal), p3, fun.Polar(p3, 0, oal));
            Vector2 p6 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p7 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p8 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p9 = fun.Inters(p4, p3, p5, fun.Polar(p5, pi / 2 + (pi / 2 - ta_ / 2.0) + 4 * pi / 180, oal));
            Vector2 p10 = fun.Polar(p1, pi / 2, fun.CalDistance(p2, p1) / 2.0);
            Vector2 p11_1 = fun.Polar(p1, 0, oal);
            Vector2 p11_2 = fun.Polar(p10, pi / -4, oal);
            Vector2 p11 = fun.Inters(p10, p11_2, p1, p11_1);
            Vector2 p12_ = fun.Polar(p5, pi + pi / 4, oal);
            Vector2 p12 = fun.Inters(p5, p12_, p1, p11_1);
            Vector2 p13_ = fun.Polar(p11, pi / -2, oal);
            Vector2 p14_ = fun.Polar(p12, pi / -2, oal);
            Vector2 p13 = fun.Inters(p11, p13_, p0_1, p0_2);
            Vector2 p14 = fun.Inters(p12, p14_, p0_1, p0_2);
            Vector2 p15 = fun.mirrorpoint(p11, p0_1, p0_2);
            Vector2 p16 = fun.mirrorpoint(p12, p0_1, p0_2);
            Vector2 p17 = fun.mirrorpoint(p10, p0_1, p0_2);
            Vector2 p18 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p19 = fun.Inters(p0, fun.Polar(p0, 0, oal), p5, p8);
            Vector2 p20_1 = fun.Polar(p0, pi / -2, dcx / 50.0);
            Vector2 p20_2 = fun.Polar(p20_1, 0, oal);
            Vector2 p20 = fun.Inters(p4, p7, p20_1, p20_2);
            Vector2 p21 = fun.Inters(p4, p7, p18, p16);
            Vector2 p22_1 = fun.Polar(p20, pi + pi / 4, oal);
            Vector2 p22_2 = fun.Polar(p18, pi / 2, fun.CalDistance(p18, p0) / 3.0);
            Vector2 p22_3 = fun.Polar(p22_2, 0, oal);
            Vector2 p22 = fun.Inters(p20, p22_1, p22_2, p22_3);
            Vector2 p23_1 = fun.Polar(p20, pi / -3, oal);
            Vector2 p23_2 = fun.Polar(p22, 0, oal);
            Vector2 p23 = fun.Inters(p20, p23_1, p22, p23_2);
            Vector2 p24_1 = fun.Polar(p19, pi, 0.5);
            Vector2 p24_2 = fun.Polar(p24_1, pi / -2 - 5 * pi / 180, oal);
            Line line5 = new Line(p24_1, p24_2);
            Arc arc1 = fun.DrawArc5(p19, line5, p8);
            Vector2 p24_3 = fun.Polar(p23, 20 * pi / 180, oal);
            Vector2 p24 = fun.Inters1(p23, p24_3, arc1, 0);
            Vector2 p25_ = fun.Polar(p20, 2.5 * pi / 180, oal);
            Vector2 p25 = fun.Inters1(p20, p25_, arc1, 0);
            Vector2 p26_ = fun.Polar(p21, 20 * pi / 180, oal);
            Vector2 p26 = fun.Inters1(p21, p26_, arc1, 0);
            Vector2 p27_ = fun.Polar(p18, pi / -2, (dcx - dconms) / 2.0 / 3.0);
            Vector2 p27 = fun.Polar(p22, pi / -2, Math.Abs(p27_.Y - p22.Y));
            Vector2 p28_1 = fun.Polar(p27, 0, oal);
            Vector2 p28_2 = fun.Polar(p16, fun.CalAngle(p26, p21) + 10 * pi / 180, oal);
            Vector2 p28 = fun.Inters(p27, p28_1, p16, p28_2);
            Vector2 p29_ = fun.Polar(p28, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p29 = fun.Inters1(p28, p29_, arc1, 0);
            Vector2 p30 = fun.Polar(p27, pi / -2, (dcx - dconms) / 2.0 / 3.0);
            Vector2 p31 = fun.Polar(p30, 0, fun.CalDistance(p27, p28));
            Vector2 p32_ = fun.Polar(p31, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p32 = fun.Inters1(p31, p32_, arc1, 0);
            Vector2 p33 = fun.Polar(p21, pi / -2, (dcx - dconms) / 2.0 / 3.0);
            Vector2 p34_ = fun.Polar(p33, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p34 = fun.Inters1(p33, p34_, arc1, 0);
            Vector2 p35_ = fun.Polar(p30, pi / -2, oal);
            Vector2 p35 = fun.Inters(p6, p7, p30, p35_);
            Vector2 p36_1 = fun.Polar(p35, fun.CalAngle(p30, p33), oal);
            Vector2 p36_2 = fun.Polar(p8, fun.CalAngle(p21, p26) + 10 * pi / 180, oal);
            Vector2 p36 = fun.Inters(p35, p36_1, p8, p36_2);

            Line line6 = new Line(p20, p25);
            Line line7 = new Line(p23, p24);
            Line line8 = new Line(p22, p23);
            Line line9 = new Line(p26, p21);
            Line line10 = new Line(p27, p28);
            Line line11 = new Line(p28, p29);
            Line line12 = new Line(p34, p33);
            Line line13 = new Line(p32, p31);
            Line line14 = new Line(p30, p31);
            Line line15 = new Line(p8, p36);
            Line line16 = new Line(p36, p35);


            Arc arc2 = fun.DrawArc4(p25, arc1.Radius, p24, 0);
            Arc arc3 = fun.DrawArc4(p20, arc1.Radius, p22, 0);
            Arc arc4 = fun.DrawArc4(p26, arc1.Radius, p29, 0);
            Arc arc5 = fun.DrawArc4(p21, arc1.Radius, p27, 0);
            Arc arc6 = fun.DrawArc4(p34, arc1.Radius, p32, 0);
            Arc arc7 = fun.DrawArc4(p33, arc1.Radius, p30, 0);

            var polyline1 = Pus.AddPointsToLwPolyLine(p3, p4, p5, p8, p7, p6, p3, p9, p5, p2, p10, p11, p13, p11, p12, p14, p12, p5);
            var polyline2 = Pus.AddPointsToLwPolyLine(p3, p2, p5, p9, p3);
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = polyline2.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = polyline2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)polyline2.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)polyline2.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 15*scale , hline1, harc1, hatching);
            /*  dxf.AddEntity(new EntityObject[] { polyline1 
                  ,line6,line7,line8 ,line9,line10,line11,line12,line13,line14,line15,line16
              ,arc2,arc3,arc4,arc5,arc6,arc7
              });*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBline(dxf, line6, 0.5, contour);
            fun.drawBline(dxf, line7, 0.5, contour);
            fun.drawBline(dxf, line8, 0.5, contour);
            fun.drawBline(dxf, line9, 0.5, contour);
            fun.drawBline(dxf, line10, 0.5, contour);
            fun.drawBline(dxf, line11, 0.5, contour);
            fun.drawBline(dxf, line12, 0.5, contour);
            fun.drawBline(dxf, line13, 0.5, contour);
            fun.drawBline(dxf, line14, 0.5, contour);
            fun.drawBline(dxf, line15, 0.5, contour);
            fun.drawBline(dxf, line16, 0.5, contour);

            Line line1 = new Line(p0_1, p0_2);
            line1.Lineweight = Lineweight.W35;//Lineweight指线宽
            line1.Layer = centre;//Layer指图层
            line1.LinetypeScale = 2;//指线性比例
            line1.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line1); //提取

            Line line2 = new Line(p15, p16);
            line2.Lineweight = Lineweight.W35;//Lineweight指线宽
            line2.Layer = refin;//Layer指图层
            line2.LinetypeScale = 2;//指线性比例
            line2.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line2); //提取

            Line line3 = new Line(p13, p15);
            line3.Lineweight = Lineweight.W35;//Lineweight指线宽
            line3.Layer = refin;//Layer指图层
            line3.LinetypeScale = 2;//指线性比例
            line3.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line3); //提取

            Line line4 = new Line(p14, p16);
            line4.Lineweight = Lineweight.W35;//Lineweight指线宽
            line4.Layer = refin;//Layer指图层
            line4.LinetypeScale = 2;//指线性比例
            line4.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line4); //提取

            Line line17 = new Line(p15, p17);
            line17.Lineweight = Lineweight.W35;//Lineweight指线宽
            line17.Layer = refin;//Layer指图层
            line17.LinetypeScale = 2;//指线性比例
            line17.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line17); //提取

            Line line18 = new Line(p16, p8);
            line18.Lineweight = Lineweight.W35;//Lineweight指线宽
            line18.Layer = refin;//Layer指图层
            line18.LinetypeScale = 2;//指线性比例
            line18.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line18); //提取

            //标注
            Vector2 v1 = fun.Polar(p11, pi, dc / 2.0);
            Vector2 v2 = fun.Polar(p8, pi / -2, dc );

            Vector2 v3 = fun.Polar(p19, pi / -4, 1.7 * 1 * scale);
            Vector2 v4 = fun.Polar(v3, pi / -4, dc);
            Vector2 v5 = fun.Polar(v4, pi / -2, 1.2 * scale);
            Vector2 v6 = fun.Polar(p8, pi / -3, 1.7 * 1 * scale);
            Vector2 v7 = fun.Polar(v6, pi / -3, dc);
            Vector2 v8 = fun.Polar(v7, pi / -2, 1.2 * scale);
            Vector2 v9 = fun.Polar(p0, pi + pi / 3, 1.7 * 1 * scale);
            Vector2 v10 = fun.Polar(v9, pi + pi / 3, dc * 1.5);
            Vector2 v11 = fun.Polar(v10, pi / -2, 1.2 * scale);
            Vector2 v12 = fun.Polar(p3, pi / 2, dc * 1.7);
            fun.dimrot1(dxf, p3, p5, 0, dc * 1.5, 2, 2 * scale, 2.4 * scale, 0.9, "OAL,LPR", "", "");
            fun.dimrot1(dxf, p4, p5, 0, dc, 2, 2 * scale, 2.4 * scale, 0.9, "SDL_1", "", "");
            fun.dimrot1(dxf, p8, p5, -90, dc * 2, 2, 2 * scale, 2.4 * scale, 0.9, "DC_1", "", "");
            //fun.dimrot1(dxf, p6, p8, 180, dc, 2, 2 * scale, 2.4 * scale, 0.9, "LF,LTA", "", "");
            fun.dimrot1(dxf, p3, p6, 90, dc * 1.5, 2, 2 * scale, 2.4 * scale, 0.9, "DC_2", "", "");
            fun.dimrot1(dxf, p1, p18, 90, dc, 2, 2 * scale, 2.4 * scale, 0.9, "DCB", "", "");
            fun.jdbz2(dxf, new Line(p4, p5), new Line(p7, p8), dc, 2 * scale, 2.4 * scale, 0.9, "SIG", "", "");
           /* fun.Axis(dxf, fun.Polar(p0, pi + pi / 3, dc * 2), 180, -90, "Z", "X", "Y", 1 * scale, 2 * scale, 0);
            fun.Axis(dxf, p0, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
            fun.Axis(dxf, p19, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v1, 110, fun.Polar(v1, 110 * pi / 180, dc / 2.0), fun.Polar(v1, 110 * pi / 180, dc), 1.2 * scale, 1.6 * scale);
           */ fun.Singlelinearrow(dxf, "LF", v2, 0, fun.Polar(v2, pi, dc / 2.0), fun.Polar(v2, pi, dc), 2 * scale, 2.4 * scale);
           
            Line linev1 = new Line(v3, v4);
            Line linev2 = new Line(v6, v7);
            Line linev3 = new Line(v9, v10);
            Text txt1 = new Text("CIP", v5, 2 * scale, 0);
            Text txt2 = new Text("CRP", v8, 2 * scale, 0);
            Text txt3 = new Text("PCS,MCS", v11, 2 * scale, 0);
            Text txt4 = new Text("ISYC=302_10", v12, 2 * scale, 0);
            /*dxf.AddEntity(new EntityObject[] { linev1 ,linev2 ,linev3
            ,txt1 ,txt2 ,txt3,txt4
            });*/

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
           
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        //图F.21 ISYC 302_11-整体套式阶梯锥面锪钻
        public static void Stepconecountersunkdril1(Dictionary<string, Object> data)  //  整体套式阶梯锥面锪钻
        {

            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
         //   double sl_ = 45;
         //   double scale = 1;
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }

            /*
            double dc_1 = 20* scale;
            double sdl_1 = 13 * scale;
            double sd_2 = 15 * scale;
            double oal = 24 * scale;
            double dc_2 = 22 * scale;
            double dcintf = 18 * scale;
            double dconms = 16 * scale;
            double lcf = 20 * scale;
            double lf = 23 * scale;
            double pl = 1 * scale;
            double lu = 17 * scale;
             double sta_2 = 90;
            double sig = 90;
            */

            double dc_1 = Convert.ToDouble(data["dc_1"]) * scale;
            double sdl_1 = Convert.ToDouble(data["sdl_1"]) * scale;
            double sd_2 = Convert.ToDouble(data["sd_2"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double dc_2 = Convert.ToDouble(data["dc_2"]) * scale;
            double dcintf = Convert.ToDouble(data["dcintf"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double lf = Convert.ToDouble(data["lf"]) * scale;
            double pl = Convert.ToDouble(data["pl"]) * scale;
            double lu = Convert.ToDouble(data["lu"]) * scale;
            double sta_2 = Convert.ToDouble(data["sta_2"]);
            double sig = Convert.ToDouble(data["sig"]);

            double sig_ = sig * pi / 180;
            double sta_2_ = sta_2 * pi / 180;

            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, oal + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, (dc_1 -(pl/ Math.Tan (pi / 2 - (sig_ / 2)))*2)/2.0);
            Vector2 p2 = fun.Polar(p1, pi / 2 + (pi / 2 - sig_/2.0), pl / Math.Cos(pi / 2 - sig_ / 2));
            Vector2 p2_ = fun.Polar(p2, pi / -2, oal);
            Vector2 p3 = fun.Polar(p2, pi, sdl_1);
            Vector2 p3_ = fun.Polar(p3, pi / -2, oal);
            Vector2 p4 = fun.Polar(p3, pi - sta_2_ / 2, (sd_2 - sdl_1 - pl) / Math.Cos(sta_2_ / 2.0));
            Vector2 p4_ = fun.Polar(p4, pi / -2, oal);
            Vector2 p5 = fun.Polar(p4, pi, (oal - sd_2));
            Vector2 p6_1 = fun.Polar(p0, pi, oal);
            Vector2 p6_2 = fun.Polar(p6_1, pi /2, dc_2 / 4.0 / 2.0);
            Vector2 p6 = fun.Polar(p6_2, pi / 2, pl/2.0);
            Vector2 p7 = fun.Polar(p6_2, 0, pl/2.0);
            Vector2 p8 = fun.Polar(p7,0, oal - lcf -pl- dc_2 / 20);
            Vector2 p9_ = fun.Polar(p8, 0, pl/2.0);
            Vector2 p9 = fun.Polar(p9_, pi / -2, pl/2.0);
            Vector2 p10 = fun.mirrorpoint(p9, p0_1, p0_2);
            Vector2 p11 = fun.mirrorpoint(p8, p0_1, p0_2);
            Vector2 p12 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p13 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p14 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p15 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p15_ = fun.Polar(p15, pi / 2, oal);
            Vector2 p16 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p16_ = fun.Polar(p16, pi / 2, oal);
            Vector2 p17 = fun.mirrorpoint(p2, p0_1, p0_2);
            Vector2 p17_ = fun.Polar(p17, pi / 2, oal);
            Vector2 p18 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p19 = fun.Polar(p5, 0, fun .CalDistance (p4,p5)/2.2);
            Vector2 p19_ = fun.Polar(p19, pi / -2, oal);
            Vector2 p20 = fun.Inters(p19, fun.Polar(p19, pi / -2, oal), p14, p15);
            Vector2 p21 = fun.Polar(p0, pi, lcf+dc_2 /30);
            Vector2 p22 = fun.Polar(p0, pi / 2, dc_2 / 30.0);
            Vector2 p23_1 = fun.Polar(p22, pi, oal);
            Vector2 p23 = fun.Inters(p22, p23_1, p19, p20);
            Vector2 p24 = fun.Polar(p1, pi / -2, dc_2 / 40);
            Vector2 p24_ = fun.Polar(p24, fun.CalAngle(p1, p2) + pi / 6/2.0, oal);
            Vector2 p25 = fun.Inters(p24, p24_, p2, p2_);
            Vector2 p25_  = fun.Polar(p25, pi, oal);
            Vector2 p26 = fun.Inters(p25, p25_ , p3, p3_);
            Vector2 p27_ = fun.Polar(p26, fun.CalAngle(p3, p4) + 1 * pi / 180, oal);
            Vector2 p27 = fun.Inters(p4, p4_, p26, p27_);
            Vector2 p28_1 = fun.Polar(p27, pi, oal);
            Vector2 p28 = fun.Inters(p19, p19_, p27, p28_1);

            Vector2 p29 = fun.Polar(p24, pi / -2, dc_2 / 30.0);
            Vector2 p30 = fun.Polar(p25, pi / -2, dc_2 / 30.0);
            Vector2 p31 = fun.Polar(p26, pi / -2, dc_2 / 30.0);
            Vector2 p32 = fun.Polar(p27, pi / -2, dc_2 / 30.0);
            Vector2 p33_ = fun.Polar(p28, pi / -2, dc_2 / 30.0);
            Vector2 p33 = fun.Polar(p33_, pi, dc_2 / 30.0);
            Vector2 p34 = fun.Polar(p18, pi / 2, (dcintf - dconms) / 2.0 / 2.0) ;
            Vector2 p35_ = fun.Polar(p34, fun.CalAngle(p18, p17), oal);
            Vector2 p35 = fun.Inters(p34, p35_, p17, p17_);
            Vector2 p36_ = fun.Polar(p35, pi, oal);
            Vector2 p36 = fun.Inters(p35, p36_, p16, p16_);
            Vector2 p37_ = fun.Polar(p36, fun.CalAngle(p16, p15), oal);
            Vector2 p37 = fun.Inters(p36, p37_, p15, p15_);
          
            Vector2 p40 = fun.Polar(p0, pi / -2, dconms / 2.0);
            Vector2 p41_ = fun.Polar(p40, fun.CalAngle(p34, p35), oal);
            Vector2 p41 = fun.Inters(p40, p41_, p2, p2_);
            Vector2 p42_ = fun.Polar(p41, pi, oal);
            Vector2 p42 = fun.Inters(p41, p42_, p3, p3_);
            Vector2 p43_ = fun.Polar(p42, fun.CalAngle(p36, p37), oal);
            Vector2 p43 = fun.Inters(p43_, p42, p4, p4_);
            Vector2 p39 = fun.Polar(p43, pi, lcf - Math.Abs(p43.X - p0.X)+dc_2 /30.0);
            Vector2 p38 = fun.Polar(p37, pi, lu+p37.X  );
            Vector2 p44 = fun.Polar(p40, pi / 2, dc_2 / 30.0);
            Vector2 p45 = fun.Polar(p41, pi / 2, dc_2 / 30.0);
            Vector2 p46 = fun.Polar(p42, pi / 2, dc_2 / 30.0);
            Vector2 p47 = fun.Polar(p43, pi / 2, dc_2 / 30.0);
            Vector2 p48_1 = fun.Polar(p47, pi, oal );
            Vector2 p48 = fun.Inters(p47, p48_1, p19, p20);
            Vector2 p48_ = fun.Inters(p48, p20, p39, p43);
            Vector2 p28_ = fun.Inters(p28, p23, p33, p32);
            Vector2 p23_ = fun.Inters(p23, p48, p21, p0);
            Vector2 p49 = fun.Polar(p0, pi / -2, dc_2 *1.7/20.0);
            Vector2 p50_ = fun.Polar(p49, pi+(fun.CalAngle(p44, p45)-pi)/10, oal);
            Vector2 p50 = fun.Inters(p49, p50_, p2, p2_);
            Vector2 p51_1 = fun.Polar(p16, 0, Math.Abs(p15.X - p16.X));
            Vector2 p51_2 = fun.Polar(p51_1, pi / 2, oal);
            Vector2 p51_3 = fun.Polar(p50, pi - fun.CalAngle(p50, p49)/7, oal);
            Vector2 p51 = fun.Inters(p51_1, p51_2, p50, p51_3);
            Vector2 p52_ = fun.Polar(p51,pi+ (fun.CalAngle(p46, p47)-pi)/2, oal);
            Vector2 p52 = fun.Inters(p51, p52_, p3, p3_);
            Vector2 p53 = fun.Inters(p51, p52_, p4, p4_);
            Vector2 p54_1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p54_ = fun.Polar(p29, pi / -2, fun.CalDistance(p29, p24)*2);
            Vector2 p54_2 = fun.Polar(p54_, fun.CalAngle(p49, p50), oal);
            Vector2 p54 = fun.Inters(p54_, p54_2, p2, p2_);
            Vector2 p55_ = fun.Polar(p54, pi - fun.CalAngle(p54, p54_), oal);
            Vector2 p55 = fun.Inters(p3, p3_, p54, p55_);
            Vector2 p56_ = fun.Polar(p55, pi + fun.CalAngle(p54, p54_)*5, oal);
            Vector2 p56 = fun.Inters(p55, p56_, p4, p4_);
            Vector2 p57 = fun.Inters(p22, p23 , p2, p17);
            Vector2 p58 = fun.Inters(p22, p23, p3, p16);
            Vector2 p59 = fun.Inters(p4, p15, p22, p23);
            Vector2 p60_ = fun.Polar(p57, pi / -2, oal);
            Vector2 p61_ = fun.Polar(p58, pi / -2, oal);
            Vector2 p62_ = fun.Polar(p59, pi / -2, oal);
            Vector2 p60 = fun.Inters(p57, p60_, p0, p21);
            Vector2 p61 = fun.Inters(p58, p61_, p0, p21);
            Vector2 p62 = fun.Inters(p59, p62_, p0, p21);
            Vector2 c56 = fun.Polar(p56, pi / -2, 0.1);
            Vector2 c56_ = fun.Polar(c56, pi+sta_2_/2 / 6, oal);
            Vector2 c53 = fun.Polar(p53, pi / -2, 0.1);
            Vector2 c53_ = fun.Polar(c53, pi + sta_2_ / 2 /8, oal);
            Vector2 c38 = fun.Polar(p38, pi / -2, 0.1);
            Vector2 c38_ = fun.Polar(c38, pi + sta_2_ / 2 /10, oal);
            Vector2 c2 = fun.Polar(p2, pi, 0.1);
            Vector2 c2_ = fun.Polar(c2, pi / -2-0.1*pi/180, oal);
            Vector2 c3 = fun.Polar(p3, pi, 0.1);
            Vector2 c3_ = fun.Polar(c3, pi / -2 - 0.1 * pi / 180, oal);
            Vector2 c4 = fun.Polar(p4, pi, 0.1);
            Vector2 c4_ = fun.Polar(c4, pi / -2 - 0.1 * pi / 180, oal);


            double dc = dc_1;
            Vector2 p49_10 = fun.Polar(p0, 0, dc * 2);
            Vector2 p50_10 = fun.Polar(p49_10, pi / 2, dc / 2.0);
            Vector2 p51_10 = fun.Polar(p50_10, 0, dc / 2.0);
            Vector2 p52_10 = fun.Polar(p50_10, pi / 2, dc / 4.0);
            Vector2 p53_10 = fun.Polar(p52_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54_10 = fun.Polar(p53_10, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55_10 = fun.Polar(p54_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56_10 = fun.Polar(p55_10, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57_10 = fun.Polar(p56_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58_10 = fun.mirrorpoint(p50_10, p0_1, p0_2);
            Vector2 p59_10 = fun.mirrorpoint(p51_10, p0_1, p0_2);
            Vector2 p60_10 = fun.mirrorpoint(p52_10, p0_1, p0_2);
            Vector2 p61_10 = fun.mirrorpoint(p53_10, p0_1, p0_2);
            Vector2 p62_10 = fun.mirrorpoint(p54_10, p0_1, p0_2);
            Vector2 p63_10 = fun.mirrorpoint(p55_10, p0_1, p0_2);
            Vector2 p64_10 = fun.mirrorpoint(p56_10, p0_1, p0_2);
            Vector2 p65_10 = fun.mirrorpoint(p57_10, p0_1, p0_2);
           
            Line line1 = new Line(c2, c2_);
            Line line2 = new Line(c3, c3_);
            Line line3 = new Line(c4, c4_);

            Arc arc1 = fun.DrawArc5(p33, new Line(c56, c56_), p56);
            Arc arc2 = fun.DrawArc5(p21, new Line(c53, c53_), p53);
            Arc arc3 = fun.DrawArc5(p39, new Line(c38, c38_), p38);
            Arc arc4 = fun.DrawArc5(p2, line1, p25);
            Arc arc5 = fun.DrawArc5(p54, line1, p57);
            Arc arc6 = fun.DrawArc5(p50, line1, p45);
            Arc arc7 = fun.DrawArc5(p35, line1, p17);
            Arc arc8 = fun.DrawArc5(p3, line2, p26);
            Arc arc9 = fun.DrawArc5(p55, line2, p58);
            Arc arc10 = fun.DrawArc5(p52, line2, p46);
            Arc arc11 = fun.DrawArc5(p36, line2, p16);

            Arc arc12 = fun.DrawArc5(p4, line3, p27);
            Arc arc13 = fun.DrawArc5(p56, line3, p59);
            Arc arc14 = fun.DrawArc5(p53, line3, p47);
            Arc arc15 = fun.DrawArc5(p37, line3, p15);
            Vector2 p63 = fun.Inters1(p28, fun .Polar (p28,pi/-2 - 0.1 * pi / 180, oal), arc1, 0);
            Vector2 p64 = fun.Inters1(p28, fun.Polar(p28, pi / -2 - 0.1 * pi / 180, oal), arc2, 0);
            Vector2 p65 = fun.Inters1(p28, fun.Polar(p28, pi / -2-0.1*pi/180, oal), arc3, 0);
          
            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14,p20,p65,p20, p15, p16, p17, p18, p1);
            polyline1 .Vertexes[5].Bulge =  Math.Tan((pi/2) / 4);
            polyline1.Vertexes[7].Bulge = -Math.Tan((pi / 2) / 4);
            polyline1.Vertexes[9].Bulge = -Math.Tan((pi / 2) / 4);
            polyline1.Vertexes[11].Bulge = Math.Tan((pi / 2) / 4);
            var polyline2 = Pus.AddPointsToLwPolyLine(p24, p25,p30,p25, p26,p31,p26, p27,p32,p27, p28, p28_,p19,p28_  , p33, p32, 
            p31, p30, p29,p54_,p54,p55,p56,p55,p54,p54_  ,p22,p57,p60,p57,p58,p61,p58,p59,p62,p59,
            p23,p63,p23_ ,p21,p0,p49,p50,p51,p53,p51,p50,p49, p44, p45,p41,p45,p46,p42,p46,p47,p43,p47,
            p48,p64,p48_, p39, p43, p42, p41, p40, p34,p35, p36, p37, p38
            
            ) ;
            var polyline3_10 = Pus.AddPointsToLwPolyLine(p50_10, p52_10, p53_10, p54_10, p55_10, p56_10, p57_10, p51_10, p50_10);
            var polyline4_10 = Pus.AddPointsToLwPolyLine(p58_10, p60_10, p61_10, p62_10, p63_10, p64_10, p65_10, p59_10, p58_10);


            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);
            fun.drawBArc(dxf, arc10, 0.5, contour);
            fun.drawBArc(dxf, arc11, 0.5, contour);
            fun.drawBArc(dxf, arc12, 0.5, contour);
            fun.drawBArc(dxf, arc13, 0.5, contour);
            fun.drawBArc(dxf, arc14, 0.5, contour);
            fun.drawBArc(dxf, arc15, 0.5, contour);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3_10, 0.5, contour);
            fun.PolyFill(dxf, polyline4_10, 0.5, contour);
            /*
            dxf.AddEntity(new EntityObject[] { polyline1,polyline2
            ,arc1,arc2,arc3,arc4,arc5,arc6,arc7,arc8,arc9,arc10,arc11,arc12,arc13,arc14,arc15  
             });

            */

            //标注
            /* fun.dimrot1(dxf, p1, p18, 90, dc, 2, 2 * scale, 2.4 * scale, 0.9, "DCB", "", "");
             fun.jdbz2(dxf, new Line(p4, p5), new Line(p7, p8), dc, 2 * scale, 2.4 * scale, 0.9, "SIG", "", "");
             fun.Axis(dxf, fun.Polar(p0, pi + pi / 3, dc * 2), 180, -90, "Z", "X", "Y", 1 * scale, 2 * scale, 0);
             fun.Axis(dxf, p0, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
             fun.Axis(dxf, p19, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
             fun.Singlelinearrow(dxf, "CCMS", v1, 110, fun.Polar(v1, 110 * pi / 180, dc / 2.0), fun.Polar(v1, 110 * pi / 180, dc), 1.2 * scale, 1.6 * scale);
           */
            Vector2 v1 = fun.Polar(p0, pi / 2, dconms / 2);
            Vector2 v2 = fun.Polar(v1, pi, lf+dc_2 /30.0);
            Vector2 v3 = fun.Polar(p0, pi / -2, dconms / 2 );
            Vector2 v4 = fun.Polar(v3, pi, lf+ dc_2 / 30.0);
            Vector2 v5 = fun.Polar(p0, pi / -3, 0.5 * 1.7 * scale);
            Vector2 v6 = fun.Polar(v5, pi / -3, dc);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            Vector2 v8 = fun.Polar(p17, pi / -3, 0.5 * 1.7 * scale);
            Vector2 v9 = fun.Polar(v8, pi / -3, dc);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p6_1, -120 * pi / 180, 0.5*1.7*scale );
            Vector2 v12 = fun.Polar(v11, -120 * pi / 180, dc*1.5);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            Vector2 v14 = fun.Polar(v2, pi, dc / 30.0);
            Vector2 v15 = fun.Polar(v14, pi / 2 + pi / 4, dc / 2.0);
            Vector2 v16 = fun.Polar(v15, pi / 2 + pi / 4, dc / 2.0);
            Vector2 v17 = fun.Polar(p0, pi / -4, dc * 2.3);
            Vector2 v18 = fun.Polar(v17, pi, dc / 2.0);
            Vector2 v19 = fun.Polar(v18, pi, dc / 2.0);
            Line linev1 = new Line(v1, v2);
            linev1.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev1.Layer = additionalline;//Layer指图层
            linev1.LinetypeScale = 5 * scale ;//指线性比例
            linev1.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev1); //提取
            Line linev2 = new Line(v3 , v4);
            linev2.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev2.Layer = additionalline;//Layer指图层
            linev2.LinetypeScale = 5 * scale ;//指线性比例
            linev2.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev2); //提取

            Line linev3 = new Line(v5, v6);
            linev3.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev3.Layer = additionalline;//Layer指图层
            linev3.LinetypeScale = 5 * scale;//指线性比例
            linev3.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev3); //提取

            Line linev4 = new Line(v8, v9);
            linev4.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev4.Layer = additionalline;//Layer指图层
            linev4.LinetypeScale = 5 * scale;//指线性比例
            linev4.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev4); //提取

            Line linev5 = new Line(v11, v12);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 * scale;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev5); //提取
            fun.dimrot1(dxf, p2, p3, 0, dc_1 /2 +10, 2, 1.2 * scale, 1.6 * scale, 0.9, "SDL_1", "", "");
            fun.dimrot1(dxf, p4, p1, 0, dc_1 /2 +20, 2, 1.2 * scale, 1.6 * scale, 0.9, "SD_2", "", "");
            fun.dimrot1(dxf, p5, p1, 0, dc_1 /2 +30, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL,LPR", "", "");
            fun.dimrot1(dxf, p1, p18, -90, dc_1 , 2, 1.2 * scale, 1.6 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p2, p17, -90, dc_1 * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC_1", "", "");
            fun.dimrot1(dxf, fun .Polar (p20,0,(lcf-lu )), p18, 180, dc_1 / 2 +10, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p39, p18, 180, dc_1 /2 +20, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF", "", "");
            fun.dimrot1(dxf, p14, p17, 180, dc_1/2 +30 , 2, 1.2 * scale, 1.6 * scale, 0.9, "LF,LTA", "", "");           
            fun.dimrot1(dxf, p5, p14, 90, dc_1 /2 +20, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC_2", "", "");
            fun.dimrot1(dxf, v2, v4, 90, dc_1 / 2 +10, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, p17 , p18 , 180, dc_1 +((p17.Y -p14.Y )/2.0-(p17.Y -p18.Y )/2.0), 2, 1.2 * scale, 1.6 * scale, 0.9, "PL,SD_1", "", "");
            fun.dimrot1(dxf, p51_10 , p59_10, 90, dc_1/30.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line(p2 , p1), new Line(p17, p18), dc_1/3.5 , 1.2 * scale, 1.6 * scale, 0.9, "SIG", "", "");
            fun.jdbz2(dxf, new Line(p3, p4), new Line(p16, p15), dc_1*1.5 , 1.2 * scale, 1.6 * scale, 0.9, "STA_2", "", "");
            fun.Axis(dxf, fun.Polar(p0, 140*pi/180, dc_1 *2.5), 180, -90, "Z", "X", "Y", 0.5 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p0, 180, -90, "", "", "", 0.5 * scale,  1.2* scale, 0);
            fun.Axis(dxf, p6_1, 180, -90, "", "", "", 0.5 * scale, 1.2 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v14, 135, v15, v16, 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v17, 0, v18, v19, 1.2 * scale, 1.6 * scale);
            Text txt1 = new Text("CIP", v7, 1.2*scale , 2);
            Text txt2 = new Text("CRP", v10, 1.2 * scale, 2);
            Text txt3 = new Text("PCS,MCS", v13, 1.2 * scale, 2);
            Circle circle1 = new Circle(Pus .ToV3 (p17,0), 0.5*1.7*scale );//圆
            dxf.AddEntity( new EntityObject[] { txt1,txt2,txt3 ,circle1   });




            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);

            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        //图F.21 ISYC 302_11-整体套式阶梯锥面锪钻
        public static void ISYC_302_11(Dictionary<string, Object> data)  //  整体套式阶梯锥面锪钻
        {

            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            //   double sl_ = 45;
            //   double scale = 1;
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }

            /*
            double dc_1 = 20* scale;
            double sdl_1 = 13 * scale;
            double sd_2 = 15 * scale;
            double oal = 24 * scale;
            double dc_2 = 22 * scale;
            double dcintf = 18 * scale;
            double dconms = 16 * scale;
            double lcf = 20 * scale;
            double lf = 23 * scale;
            double pl = 1 * scale;
            double lu = 17 * scale;
             double sta_2 = 90;
            double sig = 90;
            */
            
            double dc_1 = Convert.ToDouble(data["dc_1"]) * scale;
            double sdl_1 = Convert.ToDouble(data["sdl_1"]) * scale;
            double sd_2 = Convert.ToDouble(data["sd_2"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double dc_2 = Convert.ToDouble(data["dc_2"]) * scale;
            double dcintf = Convert.ToDouble(data["dcintf"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lcf = Convert.ToDouble(data["lcf"]) * scale;
            double lf = Convert.ToDouble(data["lf"]) * scale;
            double pl = Convert.ToDouble(data["pl"]) * scale;
            double lu = Convert.ToDouble(data["lu"]) * scale;
            double sta_2 = Convert.ToDouble(data["sta_2"]);
            double sig = Convert.ToDouble(data["sig"]);
            

            double sig_ = sig * pi / 180;
            double sta_2_ = sta_2 * pi / 180;

            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, oal + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, (dc_1 - (pl / Math.Tan(pi / 2 - (sig_ / 2))) * 2) / 2.0);
            Vector2 p2 = fun.Polar(p1, pi / 2 + (pi / 2 - sig_ / 2.0), pl / Math.Cos(pi / 2 - sig_ / 2));
            Vector2 p2_ = fun.Polar(p2, pi / -2, oal);
            Vector2 p3 = fun.Polar(p2, pi, sdl_1);
            Vector2 p3_ = fun.Polar(p3, pi / -2, oal);
            Vector2 p4 = fun.Polar(p3, pi - sta_2_ / 2, (sd_2 - sdl_1 - pl) / Math.Cos(sta_2_ / 2.0));
            Vector2 p4_ = fun.Polar(p4, pi / -2, oal);
            Vector2 p5 = fun.Polar(p4, pi, (oal - sd_2));
            Vector2 p6_1 = fun.Polar(p0, pi, oal);
            Vector2 p6_2 = fun.Polar(p6_1, pi / 2, dc_2 / 4.0 / 2.0);
            Vector2 p6 = fun.Polar(p6_2, pi / 2, pl / 2.0);
            Vector2 p7 = fun.Polar(p6_2, 0, pl / 2.0);
            Vector2 p8 = fun.Polar(p7, 0, oal - lcf - pl - dc_2 / 20);
            Vector2 p9_ = fun.Polar(p8, 0, pl / 2.0);
            Vector2 p9 = fun.Polar(p9_, pi / -2, pl / 2.0);
            Vector2 p10 = fun.mirrorpoint(p9, p0_1, p0_2);
            Vector2 p11 = fun.mirrorpoint(p8, p0_1, p0_2);
            Vector2 p12 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p13 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p14 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p15 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p15_ = fun.Polar(p15, pi / 2, oal);
            Vector2 p16 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p16_ = fun.Polar(p16, pi / 2, oal);
            Vector2 p17 = fun.mirrorpoint(p2, p0_1, p0_2);
            Vector2 p17_ = fun.Polar(p17, pi / 2, oal);
            Vector2 p18 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p19 = fun.Polar(p5, 0, fun.CalDistance(p4, p5) / 2.2);
            Vector2 p19_ = fun.Polar(p19, pi / -2, oal);
            Vector2 p20 = fun.Inters(p19, fun.Polar(p19, pi / -2, oal), p14, p15);
            Vector2 p21 = fun.Polar(p0, pi, lcf + dc_2 / 30);
            Vector2 p22 = fun.Polar(p0, pi / 2, dc_2 / 30.0);
            Vector2 p23_1 = fun.Polar(p22, pi, oal);
            Vector2 p23 = fun.Inters(p22, p23_1, p19, p20);
            Vector2 p24 = fun.Polar(p1, pi / -2, dc_2 / 40);
            Vector2 p24_ = fun.Polar(p24, fun.CalAngle(p1, p2) + pi / 6 / 2.0, oal);
            Vector2 p25 = fun.Inters(p24, p24_, p2, p2_);
            Vector2 p25_ = fun.Polar(p25, pi, oal);
            Vector2 p26 = fun.Inters(p25, p25_, p3, p3_);
            Vector2 p27_ = fun.Polar(p26, fun.CalAngle(p3, p4) + 1 * pi / 180, oal);
            Vector2 p27 = fun.Inters(p4, p4_, p26, p27_);
            Vector2 p28_1 = fun.Polar(p27, pi, oal);
            Vector2 p28 = fun.Inters(p19, p19_, p27, p28_1);

            Vector2 p29 = fun.Polar(p24, pi / -2, dc_2 / 30.0);
            Vector2 p30 = fun.Polar(p25, pi / -2, dc_2 / 30.0);
            Vector2 p31 = fun.Polar(p26, pi / -2, dc_2 / 30.0);
            Vector2 p32 = fun.Polar(p27, pi / -2, dc_2 / 30.0);
            Vector2 p33_ = fun.Polar(p28, pi / -2, dc_2 / 30.0);
            Vector2 p33 = fun.Polar(p33_, pi, dc_2 / 30.0);
            Vector2 p34 = fun.Polar(p18, pi / 2, (dcintf - dconms) / 2.0 / 2.0);
            Vector2 p35_ = fun.Polar(p34, fun.CalAngle(p18, p17), oal);
            Vector2 p35 = fun.Inters(p34, p35_, p17, p17_);
            Vector2 p36_ = fun.Polar(p35, pi, oal);
            Vector2 p36 = fun.Inters(p35, p36_, p16, p16_);
            Vector2 p37_ = fun.Polar(p36, fun.CalAngle(p16, p15), oal);
            Vector2 p37 = fun.Inters(p36, p37_, p15, p15_);

            Vector2 p40 = fun.Polar(p0, pi / -2, dconms / 2.0);
            Vector2 p41_ = fun.Polar(p40, fun.CalAngle(p34, p35), oal);
            Vector2 p41 = fun.Inters(p40, p41_, p2, p2_);
            Vector2 p42_ = fun.Polar(p41, pi, oal);
            Vector2 p42 = fun.Inters(p41, p42_, p3, p3_);
            Vector2 p43_ = fun.Polar(p42, fun.CalAngle(p36, p37), oal);
            Vector2 p43 = fun.Inters(p43_, p42, p4, p4_);
            Vector2 p39 = fun.Polar(p43, pi, lcf - Math.Abs(p43.X - p0.X) + dc_2 / 30.0);
            Vector2 p38 = fun.Polar(p37, pi, lu + p37.X);
            Vector2 p44 = fun.Polar(p40, pi / 2, dc_2 / 30.0);
            Vector2 p45 = fun.Polar(p41, pi / 2, dc_2 / 30.0);
            Vector2 p46 = fun.Polar(p42, pi / 2, dc_2 / 30.0);
            Vector2 p47 = fun.Polar(p43, pi / 2, dc_2 / 30.0);
            Vector2 p48_1 = fun.Polar(p47, pi, oal);
            Vector2 p48 = fun.Inters(p47, p48_1, p19, p20);
            Vector2 p48_ = fun.Inters(p48, p20, p39, p43);
            Vector2 p28_ = fun.Inters(p28, p23, p33, p32);
            Vector2 p23_ = fun.Inters(p23, p48, p21, p0);
            Vector2 p49 = fun.Polar(p0, pi / -2, dc_2 * 1.7 / 20.0);
            Vector2 p50_ = fun.Polar(p49, pi + (fun.CalAngle(p44, p45) - pi) / 10, oal);
            Vector2 p50 = fun.Inters(p49, p50_, p2, p2_);
            Vector2 p51_1 = fun.Polar(p16, 0, Math.Abs(p15.X - p16.X));
            Vector2 p51_2 = fun.Polar(p51_1, pi / 2, oal);
            Vector2 p51_3 = fun.Polar(p50, pi - fun.CalAngle(p50, p49) / 7, oal);
            Vector2 p51 = fun.Inters(p51_1, p51_2, p50, p51_3);
            Vector2 p52_ = fun.Polar(p51, pi + (fun.CalAngle(p46, p47) - pi) / 2, oal);
            Vector2 p52 = fun.Inters(p51, p52_, p3, p3_);
            Vector2 p53 = fun.Inters(p51, p52_, p4, p4_);
            Vector2 p54_1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p54_ = fun.Polar(p29, pi / -2, fun.CalDistance(p29, p24) * 2);
            Vector2 p54_2 = fun.Polar(p54_, fun.CalAngle(p49, p50), oal);
            Vector2 p54 = fun.Inters(p54_, p54_2, p2, p2_);
            Vector2 p55_ = fun.Polar(p54, pi - fun.CalAngle(p54, p54_), oal);
            Vector2 p55 = fun.Inters(p3, p3_, p54, p55_);
            Vector2 p56_ = fun.Polar(p55, pi + fun.CalAngle(p54, p54_) * 5, oal);
            Vector2 p56 = fun.Inters(p55, p56_, p4, p4_);
            Vector2 p57 = fun.Inters(p22, p23, p2, p17);
            Vector2 p58 = fun.Inters(p22, p23, p3, p16);
            Vector2 p59 = fun.Inters(p4, p15, p22, p23);
            Vector2 p60_ = fun.Polar(p57, pi / -2, oal);
            Vector2 p61_ = fun.Polar(p58, pi / -2, oal);
            Vector2 p62_ = fun.Polar(p59, pi / -2, oal);
            Vector2 p60 = fun.Inters(p57, p60_, p0, p21);
            Vector2 p61 = fun.Inters(p58, p61_, p0, p21);
            Vector2 p62 = fun.Inters(p59, p62_, p0, p21);
            Vector2 c56 = fun.Polar(p56, pi / -2, 0.1);
            Vector2 c56_ = fun.Polar(c56, pi + sta_2_ / 2 / 6, oal);
            Vector2 c53 = fun.Polar(p53, pi / -2, 0.1);
            Vector2 c53_ = fun.Polar(c53, pi + sta_2_ / 2 / 8, oal);
            Vector2 c38 = fun.Polar(p38, pi / -2, 0.1);
            Vector2 c38_ = fun.Polar(c38, pi + sta_2_ / 2 / 10, oal);
            Vector2 c2 = fun.Polar(p2, pi, 0.1);
            Vector2 c2_ = fun.Polar(c2, pi / -2 - 0.1 * pi / 180, oal);
            Vector2 c3 = fun.Polar(p3, pi, 0.1);
            Vector2 c3_ = fun.Polar(c3, pi / -2 - 0.1 * pi / 180, oal);
            Vector2 c4 = fun.Polar(p4, pi, 0.1);
            Vector2 c4_ = fun.Polar(c4, pi / -2 - 0.1 * pi / 180, oal);


            double dc = dc_1;
            Vector2 p49_10 = fun.Polar(p0, 0, dc * 2);
            Vector2 p50_10 = fun.Polar(p49_10, pi / 2, dc / 2.0);
            Vector2 p51_10 = fun.Polar(p50_10, 0, dc / 2.0);
            Vector2 p52_10 = fun.Polar(p50_10, pi / 2, dc / 4.0);
            Vector2 p53_10 = fun.Polar(p52_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54_10 = fun.Polar(p53_10, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55_10 = fun.Polar(p54_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56_10 = fun.Polar(p55_10, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57_10 = fun.Polar(p56_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58_10 = fun.mirrorpoint(p50_10, p0_1, p0_2);
            Vector2 p59_10 = fun.mirrorpoint(p51_10, p0_1, p0_2);
            Vector2 p60_10 = fun.mirrorpoint(p52_10, p0_1, p0_2);
            Vector2 p61_10 = fun.mirrorpoint(p53_10, p0_1, p0_2);
            Vector2 p62_10 = fun.mirrorpoint(p54_10, p0_1, p0_2);
            Vector2 p63_10 = fun.mirrorpoint(p55_10, p0_1, p0_2);
            Vector2 p64_10 = fun.mirrorpoint(p56_10, p0_1, p0_2);
            Vector2 p65_10 = fun.mirrorpoint(p57_10, p0_1, p0_2);

            Line line1 = new Line(c2, c2_);
            Line line2 = new Line(c3, c3_);
            Line line3 = new Line(c4, c4_);

            Arc arc1 = fun.DrawArc5(p33, new Line(c56, c56_), p56);
            Arc arc2 = fun.DrawArc5(p21, new Line(c53, c53_), p53);
            Arc arc3 = fun.DrawArc5(p39, new Line(c38, c38_), p38);
            Arc arc4 = fun.DrawArc5(p2, line1, p25);
            Arc arc5 = fun.DrawArc5(p54, line1, p57);
            Arc arc6 = fun.DrawArc5(p50, line1, p45);
            Arc arc7 = fun.DrawArc5(p35, line1, p17);
            Arc arc8 = fun.DrawArc5(p3, line2, p26);
            Arc arc9 = fun.DrawArc5(p55, line2, p58);
            Arc arc10 = fun.DrawArc5(p52, line2, p46);
            Arc arc11 = fun.DrawArc5(p36, line2, p16);

            Arc arc12 = fun.DrawArc5(p4, line3, p27);
            Arc arc13 = fun.DrawArc5(p56, line3, p59);
            Arc arc14 = fun.DrawArc5(p53, line3, p47);
            Arc arc15 = fun.DrawArc5(p37, line3, p15);
            Vector2 p63 = fun.Inters1(p28, fun.Polar(p28, pi / -2 - 0.1 * pi / 180, oal), arc1, 0);
            Vector2 p64 = fun.Inters1(p28, fun.Polar(p28, pi / -2 - 0.1 * pi / 180, oal), arc2, 0);
            Vector2 p65 = fun.Inters1(p28, fun.Polar(p28, pi / -2 - 0.1 * pi / 180, oal), arc3, 0);

            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p20, p65, p20, p15, p16, p17, p18, p1);
            polyline1.Vertexes[5].Bulge = Math.Tan((pi / 2) / 4);
            polyline1.Vertexes[7].Bulge = -Math.Tan((pi / 2) / 4);
            polyline1.Vertexes[9].Bulge = -Math.Tan((pi / 2) / 4);
            polyline1.Vertexes[11].Bulge = Math.Tan((pi / 2) / 4);
            var polyline2 = Pus.AddPointsToLwPolyLine(p24, p25, p30, p25, p26, p31, p26, p27, p32, p27, p28, p28_, p19, p28_, p33, p32,
            p31, p30, p29, p54_, p54, p55, p56, p55, p54, p54_, p22, p57, p60, p57, p58, p61, p58, p59, p62, p59,
            p23, p63, p23_, p21, p0, p49, p50, p51, p53, p51, p50, p49, p44, p45, p41, p45, p46, p42, p46, p47, p43, p47,
            p48, p64, p48_, p39, p43, p42, p41, p40, p34, p35, p36, p37, p38

            );
            var polyline3_10 = Pus.AddPointsToLwPolyLine(p50_10, p52_10, p53_10, p54_10, p55_10, p56_10, p57_10, p51_10, p50_10);
            var polyline4_10 = Pus.AddPointsToLwPolyLine(p58_10, p60_10, p61_10, p62_10, p63_10, p64_10, p65_10, p59_10, p58_10);


            fun.drawBArc(dxf, arc1, 0.5, contour);
            fun.drawBArc(dxf, arc2, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            fun.drawBArc(dxf, arc8, 0.5, contour);
            fun.drawBArc(dxf, arc9, 0.5, contour);
            fun.drawBArc(dxf, arc10, 0.5, contour);
            fun.drawBArc(dxf, arc11, 0.5, contour);
            fun.drawBArc(dxf, arc12, 0.5, contour);
            fun.drawBArc(dxf, arc13, 0.5, contour);
            fun.drawBArc(dxf, arc14, 0.5, contour);
            fun.drawBArc(dxf, arc15, 0.5, contour);
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
          /*  fun.PolyFill(dxf, polyline3_10, 0.5, contour);
            fun.PolyFill(dxf, polyline4_10, 0.5, contour);
            
            dxf.AddEntity(new EntityObject[] { polyline1,polyline2
            ,arc1,arc2,arc3,arc4,arc5,arc6,arc7,arc8,arc9,arc10,arc11,arc12,arc13,arc14,arc15  
             });

            */

            //标注
            
            Vector2 v1 = fun.Polar(p0, pi / 2, dconms / 2);
            Vector2 v2 = fun.Polar(v1, pi, lf + dc_2 / 30.0);
            Vector2 v3 = fun.Polar(p0, pi / -2, dconms / 2);
            Vector2 v4 = fun.Polar(v3, pi, lf + dc_2 / 30.0);
            Vector2 v5 = fun.Polar(p0, pi / -3, 0.5 * 1.7 * scale);
            Vector2 v6 = fun.Polar(v5, pi / -3, dc);
            Vector2 v7 = fun.Polar(v6, pi / -2, 1.2 * scale);
            Vector2 v8 = fun.Polar(p17, pi / -3, 0.5 * 1.7 * scale);
            Vector2 v9 = fun.Polar(v8, pi / -3, dc);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p6_1, -120 * pi / 180, 0.5 * 1.7 * scale);
            Vector2 v12 = fun.Polar(v11, -120 * pi / 180, dc * 1.5);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);
            Vector2 v14 = fun.Polar(v2, pi, dc / 30.0);
            Vector2 v15 = fun.Polar(v14, pi / 2 + pi / 4, dc / 2.0);
            Vector2 v16 = fun.Polar(v15, pi / 2 + pi / 4, dc / 2.0);
            Vector2 v17 = fun.Polar(p0, pi / -4, dc * 2.3);
            Vector2 v18 = fun.Polar(v17, pi, dc / 2.0);
            Vector2 v19 = fun.Polar(v18, pi, dc / 2.0);

            Vector2 v20 = fun.Polar(p17, pi / -2, dc*1.3  + 2.5);
            Vector2 v21 = fun.Polar(p17, pi / -2, dc*1.3  + 3);
            Vector2 v22 = fun.Polar(v20, pi, dc / 2.0);
            Vector2 v23 = fun.Polar(v22, pi, dc / 2.0);
            Line linev1 = new Line(v1, v2);
            linev1.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev1.Layer = additionalline;//Layer指图层
            linev1.LinetypeScale = 5 * scale;//指线性比例
            linev1.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev1); //提取
            Line linev2 = new Line(v3, v4);
            linev2.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev2.Layer = additionalline;//Layer指图层
            linev2.LinetypeScale = 5 * scale;//指线性比例
            linev2.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(linev2); //提取

            Line linev3 = new Line(v5, v6);
            linev3.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev3.Layer = additionalline;//Layer指图层
            linev3.LinetypeScale = 5 * scale;//指线性比例
            linev3.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            //dxf.AddEntity(linev3); //提取

            Line linev4 = new Line(v8, v9);
            linev4.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev4.Layer = additionalline;//Layer指图层
            linev4.LinetypeScale = 5 * scale;//指线性比例
            linev4.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            //dxf.AddEntity(linev4); //提取

            Line linev5 = new Line(v11, v12);
            linev5.Lineweight = Lineweight.W35;//Lineweight指线宽
            linev5.Layer = additionalline;//Layer指图层
            linev5.LinetypeScale = 5 * scale;//指线性比例
            linev5.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            //dxf.AddEntity(linev5); //提取

            Line linev6 = new Line(p17, v21);
            dxf.AddEntity(linev6);
            fun.dimrot1(dxf, p2, p3, 0, dc_1 / 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "SDL_1", "", "");
            fun.dimrot1(dxf, p4, p1, 0, dc_1, 2, 1.2 * scale, 1.6 * scale, 0.9, "SD_2", "", "");
            fun.dimrot1(dxf, p5, p1, 0, dc_1 * 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL,LPR", "", "");
            fun.dimrot1(dxf, p1, p18, -90, dc_1, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p2, p17, -90, dc_1 * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC_1", "", "");
            fun.dimrot1(dxf, fun.Polar(p20, 0, (lcf - lu)), p18, 180, dc_1 / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p39, p18, 180, dc_1 / 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LCF", "", "");
            //fun.dimrot1(dxf, p14, p17, 180, dc_1, 2, 1.2 * scale, 1.6 * scale, 0.9, "LF,LTA", "", "");
            fun.dimrot1(dxf, p5, p14, 90, dc_1 * 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC_2", "", "");
            fun.dimrot1(dxf, v2, v4, 90, dc_1 / 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCB", "", "");
            fun.dimrot1(dxf, p17, p18, 180, dc_1 + ((p17.Y - p14.Y) / 2.0 - (p17.Y - p18.Y) / 2.0), 2, 1.2 * scale, 1.6 * scale, 0.9, "PL,SD_1", "", "");
            //fun.dimrot1(dxf, p51_10, p59_10, 90, dc_1 / 30.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "PHD", "", "");
            fun.jdbz2(dxf, new Line(p2, p1), new Line(p17, p18), dc_1 / 3.5, 1.2 * scale, 1.6 * scale, 0.9, "SIG", "", "");
            fun.jdbz2(dxf, new Line(p3, p4), new Line(p16, p15), dc_1 * 1.5, 1.2 * scale, 1.6 * scale, 0.9, "STA_2", "", "");
          /*  fun.Axis(dxf, fun.Polar(p0, 140 * pi / 180, dc_1 * 2.5), 180, -90, "Z", "X", "Y", 0.5 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p0, 180, -90, "", "", "", 0.5 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p6_1, 180, -90, "", "", "", 0.5 * scale, 1.2 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v14, 135, v15, v16, 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v17, 0, v18, v19, 1.2 * scale, 1.6 * scale);*/
            fun.Singlelinearrow(dxf, "LF", v20, 0, v22, v23, 1.2 * scale, 1.6 * scale);
            Text txt1 = new Text("CIP", v7, 1.2 * scale, 2);
            Text txt2 = new Text("CRP", v10, 1.2 * scale, 2);
            Text txt3 = new Text("PCS,MCS", v13, 1.2 * scale, 2);
            Circle circle1 = new Circle(Pus.ToV3(p17, 0), 0.5 * 1.7 * scale);//圆
                                                                             // dxf.AddEntity(new EntityObject[] { txt1, txt2, txt3, circle1 });

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        //图F.22  ISYC 302-12-整体圆柱柄阶梯式锥面锪钻
        public static void Conecountersunkdrill1(Dictionary<string, Object> data)  //  整体圆柱柄阶梯式锥面锪钻
        {

            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            //   double sl_ = 120;
            //   double scale = 1;
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            
            /*
            double dcintf = 20*scale ;
            double dconms = 20 * scale;
            double ls = 70 * scale;
            double dc_1 = 25 * scale;
            double dc_2 = 30 * scale;
            double dc_3 = 37 * scale;
            double pl = 4.2 * scale;
            double sdl_1 = 5.75 * scale;
            double sd_2 = 12 * scale;
            double sdl_2 = 4.3 * scale;
            double sd_3 = 17.3 * scale;
            double sdl_3 = 6.5 * scale;
            double lh = 26 * scale;
            double oal = 150 * scale;
            */

            double dcintf = Convert.ToDouble(data["dcintf"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double ls = Convert.ToDouble(data["ls"]) * scale;
            double dc_1 = Convert.ToDouble(data["dc_1"]) * scale;
            double dc_2 = Convert.ToDouble(data["dc_2"]) * scale;
            double dc_3 = Convert.ToDouble(data["dc_3"]) * scale;
            double pl = Convert.ToDouble(data["pl"]) * scale;
            double sdl_1 = Convert.ToDouble(data["sdl_1"]) * scale;
            double sd_2 = Convert.ToDouble(data["sd_2"]) * scale;
            double sdl_2 = Convert.ToDouble(data["sdl_2"]) * scale;
            double sd_3 = Convert.ToDouble(data["sd_3"]) * scale;
            double sdl_3 = Convert.ToDouble(data["sdl_3"]) * scale;
            double lh = Convert.ToDouble(data["lh"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double m1 = Math .Sqrt (Math.Pow((dc_1 - dcintf) / 2.0, 2)+(pl*pl ));
            double m2 = Math.Sqrt(Math.Pow(sd_2 - sdl_1 - pl, 2) + Math.Pow((dc_2 - dc_1)/2.0, 2));
            double m3 = Math.Sqrt(Math.Pow((dc_3 - dc_2) / 2.0, 2) + Math.Pow(sd_3 - sd_2 - sdl_2, 2));
            
            double a = Math.Acos((Math.Pow((dc_1 - dcintf) / 2.0, 2) + Math.Pow(m1, 2) - Math.Pow(pl, 2)) / (2 * ((dc_1 - dcintf) / 2.0) * (m1)));
            double b= Math.Acos((Math.Pow((dc_2 - dc_1 ) / 2.0, 2) + Math.Pow(m2, 2) - Math.Pow(sd_2-pl-sdl_1  , 2)) / (2 * ((dc_2 - dc_1 ) / 2.0) * (m2)));
            double c= Math.Acos((Math.Pow((dc_3 - dc_2 ) / 2.0, 2) + Math.Pow(m3, 2) - Math.Pow(m3, 2)) / (2 * ((dc_3 - dc_2 ) / 2.0) * (m3)));
            
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, 5);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1 = fun.Polar(p0, pi / 2, dcintf/2.0);
            Vector2 p2 = fun.Polar(p1, pi/2-a ,m1 );
            Vector2 p3 = fun.Polar(p2, 0, sdl_1);
            Vector2 p4 = fun.Polar(p3, pi / 2 - b, m2);
            Vector2 p5 = fun.Polar(p4, 0, sdl_2);
            Vector2 p6 = fun.Polar(p5, c, m3);
            Vector2 p7 = fun.Polar(p6, 0, sdl_3);
            Vector2 p8_1 = fun.Polar(p7, -fun.CalAngle(p5, p6), oal);
            Vector2 p8_2 = fun.Polar(p5, 0, oal);
            Vector2 p8 = fun.Inters(p7, p8_1, p5, p8_2);
            Vector2 p9 = fun.mirrorpoint(p8, p0_1, p0_2);
            Vector2 p10 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p11 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p12 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p13 = fun.mirrorpoint(p4, p0_1, p0_2);
            Vector2 p14 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p15 = fun.mirrorpoint(p2, p0_1, p0_2);
            Vector2 p16 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p17 = fun.Polar(p0, pi / -2, dcintf / 20);
            Vector2 p18 = fun.Polar(p17, pi / 2, dcintf * 4 / 10);
            Vector2 p19_ = fun.Polar(p18, fun.CalAngle(p1, p8), oal);
            Vector2 p19 = fun.Inters(p18, p19_, p8, p9);
            Vector2 p20 = fun.Polar(p17, pi / -2, dcintf * 4 / 10);
            Vector2 p21_1 = fun.Polar(p20, fun.CalAngle(p1, p8), oal);
            Vector2 p21_2 = fun.Polar(p10, pi / 2, oal);
            Vector2 p21 = fun.Inters(p20, p21_1, p10, p21_2);
            Vector2 p22_ = fun.Polar(p17, fun.CalAngle(p1, p8), oal);
            Vector2 p22 = fun.Inters(p17, p22_, p8, p9);
            Vector2 p23 = fun.Inters(p18, p19, p2, p15);
            Vector2 p24 = fun.Inters(p18, p19, p3, p14);
            Vector2 p25 = fun.Inters(p18, p19, p4, p13);
            Vector2 p26 = fun.Inters(p18, p19, p5, p12);
            Vector2 p27 = fun.Inters(p18, p19, p6, p11);
            Vector2 p28 = fun.Inters(p18, p19, p7, p10);
            Vector2 p29 = fun.Inters(p17, p22, p2, p15);
            Vector2 p30= fun.Inters(p17, p22, p3, p14);
            Vector2 p31= fun.Inters(p17, p22, p4, p13); 
            Vector2 p32= fun.Inters(p17, p22, p5, p12);
            Vector2 p33= fun.Inters(p17, p22, p6, p11);
            Vector2 p34= fun.Inters(p17, p22, p7, p10);
            Vector2 p35 = fun.Inters(p20, p21, p2, p15);
            Vector2 p36= fun.Inters(p20, p21, p3, p14);
            Vector2 p37= fun.Inters(p20, p21, p4, p13);
            Vector2 p38= fun.Inters(p20, p21, p5, p12);
            Vector2 p39= fun.Inters(p20, p21, p6, p11);
            Vector2 p40 = fun.Polar(p0, 0, oal);
            Vector2 p41 = fun.Polar(p40, pi / 2, dconms / 2.0-dconms /20.0);
            Vector2 p42 = fun.Polar(p41, pi - pi / 4, Math.Sqrt(2) * dconms / 20.0);
            Vector2 p43=fun .Polar (p42,pi,ls);
            Vector2 p44 = fun.Polar(p43, pi - fun.CalAngle(p42, p41), Math.Sqrt(2) * dconms / 20.0);
            Vector2 p45_ = fun.Polar(p44, pi, oal );
            Vector2 p45 = fun.Inters(p44, p45_, p8, p9);
            Vector2 p46 = fun.mirrorpoint(p45, p0_1, p0_2);
            Vector2 p47= fun.mirrorpoint(p44, p0_1, p0_2);
            Vector2 p48= fun.mirrorpoint(p43, p0_1, p0_2); 
            Vector2 p49= fun.mirrorpoint(p42, p0_1, p0_2);
            Vector2 p50= fun.mirrorpoint(p41, p0_1, p0_2);
            Vector2 p51 = fun.Polar(p0, pi, lh / 10);
            Vector2 p52 = fun.Polar(p51, pi / 2, dc_3 / 2.0 + dc_3 / 10.0);
            Vector2 p53 = fun.Polar(p52, 0, lh + lh / 10.0 + lh / 10.0);
            Vector2 p54 = fun.Polar(p53, pi / -2, dc_3 + dc_3 / 10.0 + dc_3 / 10.0);
            Vector2 p55 = fun.Polar(p54, pi, lh + lh / 10.0 + lh / 10.0);


            Vector2 p0_ = fun.Polar(p0, pi / -2, oal*1.5);
            Vector2 p0_1_ = fun.Polar(p0_, pi, 5 * 2);
            Vector2 p0_2_ = fun.Polar(p0_, 0,(lh +5)*2);
            Vector2 p1_ = fun.Polar(p0_, pi / 2, dcintf / 2.0*2);
            Vector2 p2_ = fun.Polar(p1_, pi / 2 - a, m1 * 2);
            Vector2 p3_ = fun.Polar(p2_, 0, sdl_1 * 2);
            Vector2 p4_ = fun.Polar(p3_, pi / 2 - b, m2 * 2);
            Vector2 p5_ = fun.Polar(p4_, 0, sdl_2 * 2);
            Vector2 p6_ = fun.Polar(p5_, c, m3 * 2);
            Vector2 p7_ = fun.Polar(p6_, 0, sdl_3 * 2);
            Vector2 p8_1_ = fun.Polar(p7_, -fun.CalAngle(p5, p6), oal*2);
            Vector2 p8_2_ = fun.Polar(p5_, 0, oal*2 );
            Vector2 p8_ = fun.Inters(p7_, p8_1_, p5_, p8_2_);
            Vector2 p9_ = fun.mirrorpoint(p8_, p0_1_, p0_2_);
            Vector2 p10_ = fun.mirrorpoint(p7_, p0_1_, p0_2_);
            Vector2 p11_ = fun.mirrorpoint(p6_, p0_1_, p0_2_);
            Vector2 p12_ = fun.mirrorpoint(p5_, p0_1_, p0_2_);
            Vector2 p13_ = fun.mirrorpoint(p4_, p0_1_, p0_2_);
            Vector2 p14_ = fun.mirrorpoint(p3_, p0_1_, p0_2_);
            Vector2 p15_ = fun.mirrorpoint(p2_, p0_1_, p0_2_);
            Vector2 p16_ = fun.mirrorpoint(p1_, p0_1_, p0_2_);
            Vector2 p17_ = fun.Polar(p0_, pi / -2, dcintf / 20 * 2);
            Vector2 p18_ = fun.Polar(p17_, pi / 2, dcintf * 4 / 10 * 2);
            Vector2 p19_1 = fun.Polar(p18_, fun.CalAngle(p1, p8), oal * 2);
            Vector2 p19_2 = fun.Inters(p18_, p19_1, p8_, p9_);
            Vector2 p20_ = fun.Polar(p17_, pi / -2, dcintf * 4 / 10 * 2);
            Vector2 p21_1_ = fun.Polar(p20_, fun.CalAngle(p1, p8), oal * 2);
            Vector2 p21_2_ = fun.Polar(p10_, pi / 2, oal * 2);
            Vector2 p21_ = fun.Inters(p20_, p21_1_, p10_, p21_2_);
            Vector2 p22_1 = fun.Polar(p17_, fun.CalAngle(p1, p8), oal * 2);
            Vector2 p22_2 = fun.Inters(p17_, p22_1, p8_, p9_);
            Vector2 p23_ = fun.Inters(p18_, p19_2, p2_, p15_);
            Vector2 p24_ = fun.Inters(p18_, p19_2, p3_, p14_);
            Vector2 p25_ = fun.Inters(p18_, p19_2, p4_, p13_);
            Vector2 p26_ = fun.Inters(p18_, p19_2, p5_, p12_);
            Vector2 p27_ = fun.Inters(p18_, p19_2, p6_, p11_);
            Vector2 p28_ = fun.Inters(p18_, p19_2, p7_, p10_);
            Vector2 p29_ = fun.Inters(p17_, p22_2, p2_, p15_);
            Vector2 p30_ = fun.Inters(p17_, p22_2, p3_, p14_);
            Vector2 p31_ = fun.Inters(p17_, p22_2, p4_, p13_);
            Vector2 p32_ = fun.Inters(p17_, p22_2, p5_, p12_);
            Vector2 p33_ = fun.Inters(p17_, p22_2, p6_, p11_);
            Vector2 p34_ = fun.Inters(p17_, p22_2, p7_, p10_);
            Vector2 p35_ = fun.Inters(p20_, p21_, p2_, p15_);
            Vector2 p36_ = fun.Inters(p20_, p21_, p3_, p14_);
            Vector2 p37_ = fun.Inters(p20_, p21_, p4_, p13_);
            Vector2 p38_ = fun.Inters(p20_, p21_, p5_, p12_);
            Vector2 p39_ = fun.Inters(p20_, p21_, p6_, p11_);



            double dc = dc_3;
            Vector2 p49_10 = fun.Polar(p0, pi, dc * 2);
            Vector2 p50_10 = fun.Polar(p49_10, pi / 2, dc / 2.0);
            Vector2 p51_10 = fun.Polar(p50_10, 0, dc / 2.0);
            Vector2 p52_10 = fun.Polar(p50_10, pi / 2, dc / 4.0);
            Vector2 p53_10 = fun.Polar(p52_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p54_10 = fun.Polar(p53_10, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p55_10 = fun.Polar(p54_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p56_10 = fun.Polar(p55_10, -10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p57_10 = fun.Polar(p56_10, 10 * pi / 180, (dc / 2.0 / 5.0) / Math.Cos(10 * pi / 180));
            Vector2 p58_10 = fun.mirrorpoint(p50_10, p0_1, p0_2);
            Vector2 p59_10 = fun.mirrorpoint(p51_10, p0_1, p0_2);
            Vector2 p60_10 = fun.mirrorpoint(p52_10, p0_1, p0_2);
            Vector2 p61_10 = fun.mirrorpoint(p53_10, p0_1, p0_2);
            Vector2 p62_10 = fun.mirrorpoint(p54_10, p0_1, p0_2);
            Vector2 p63_10 = fun.mirrorpoint(p55_10, p0_1, p0_2);
            Vector2 p64_10 = fun.mirrorpoint(p56_10, p0_1, p0_2);
            Vector2 p65_10 = fun.mirrorpoint(p57_10, p0_1, p0_2);


            Line line1 = new Line(fun.Polar(p22, 0, 0.1 * scale), fun.Polar(fun.Polar(p22, 0, 0.1 * scale), pi / -2 - fun.CalAngle(p1, p8), oal));
            Arc arc1 = fun.DrawArc5(p21, line1, p22);
            var polyline1 = Pus.AddPointsToLwPolyLine(p1, p2, p3, p4, p5, p6, p7, p8, p9,p46,p47,p48,p49,p50,
                p41,p42,p49,p42,p43,p48,p43,p44,p47,p44,p45,p9,p10, p11, p12, p13, p14, p15, p16, p1) ;
            var polyline2 = Pus.AddPointsToLwPolyLine(p18, p23, p29, p17, p30, p24, p23, p25, p31, p30, p32, p26, p25, p27, p33, p32, p34, p28, p27,
                 p19, p22, p34, p17, p20, p35, p15, p14, p36, p35, p37, p13, p12, p38, p37, p39, p11, p10, p21, p39);
            var polyline3_10 = Pus.AddPointsToLwPolyLine(p50_10, p52_10, p53_10, p54_10, p55_10, p56_10, p57_10, p51_10, p50_10);
            var polyline4_10 = Pus.AddPointsToLwPolyLine(p58_10, p60_10, p61_10, p62_10, p63_10, p64_10, p65_10, p59_10, p58_10);

            Line line100 = new Line(p18_, p23_);
            Line  line101 = new Line (p24_, p25_);
            Line line102 = new Line(p18_, p19_2);
            dxf.AddEntity(new EntityObject[] { line100, line101,line102  });
            var polyline3 = Pus.AddPointsToLwPolyLine(p18_, p23_, p29_, p17_, p30_, p24_, p23_, p25_, p31_, p30_, p32_, p26_, p25_, p27_, p33_, p32_, p34_, p28_, p27_,
                 p19_2, p22_2, p34_, p17_, p20_, p35_, p15_, p14_, p36_, p35_, p37_, p13_, p12_, p38_, p37_, p39_, p11_, p10_, p21_, p39_);
            var polyline4= Pus.AddPointsToLwPolyLine(p1_, p2_, p3_, p4_, p5_, p6_, p7_, p8_, p9_, p10_, p11_, p12_, p13_, p14_, p15_, p16_, p1_);

           /* dxf.AddEntity( new EntityObject[] { polyline1,polyline2  ,polyline3_10,polyline4_10 ,polyline3 ,polyline4 
            ,arc1 
            });*/
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            fun.PolyFill(dxf, polyline3_10, 0.5, contour);
            fun.PolyFill(dxf, polyline4_10, 0.5, contour);
            Line line2 = new Line(p52, p53);
            line2.Lineweight = Lineweight.W35;//Lineweight指线宽
            line2.Layer = additionalline;//Layer指图层
            line2.LinetypeScale = 10 / scale ;//指线性比例
            line2.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line2); //提取

            Line line3 = new Line(p54, p53);
            line3.Lineweight = Lineweight.W35;//Lineweight指线宽
            line3.Layer = additionalline;//Layer指图层
            line3.LinetypeScale = 10 / scale ;//指线性比例
            line3.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line3); //提取

            Line line4 = new Line(p52, p55);
            line4.Lineweight = Lineweight.W35;//Lineweight指线宽
            line4.Layer = additionalline;//Layer指图层
            line4.LinetypeScale = 10 / scale ;//指线性比例
            line4.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line4); //提取

            Line line5 = new Line(p54, p55);
            line5.Lineweight = Lineweight.W35;//Lineweight指线宽
            line5.Layer = additionalline;//Layer指图层
            line5.LinetypeScale = 10 / scale ;//指线性比例
            line5.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line5); //提取

            //标注
         
            double lu = (oal - lh - ls + lh - (oal - lh - ls) / 8.0);
            double lta = oal - lh - ls + lh + (ls / 3.0)-p2.X ;
            Vector2 v1_ = fun.Polar(p1, 0, lu);
            Vector2 v1 = fun.Inters(v1_, fun.Polar(v1_, pi / -2, oal), p45, p44);
            Vector2 v2 = fun.Polar(p0, 0, lta);

            Vector2 v3 = fun.Polar(v2, pi / 2, dconms);
            Vector2 v4 = fun.Polar(v3, pi / 4, dconms / 5.0);
            Vector2 v5 = fun.Polar(v4, 0, dconms / 2.0);
            Vector2 v6 = fun.mirrorpoint(v3, p0_1, p0_2);
            Vector2 v7= fun.mirrorpoint(v4, p0_1, p0_2);
            Vector2 v8= fun.mirrorpoint(v5, p0_1, p0_2);
            Vector2 v9_ = fun.Polar(v2, pi / 3, oal);
            Vector2 v9 = fun.Inters(v2, v9_, p42, p43);
            Vector2 v10 = fun.Polar(v9, pi / 3, dconms / 2.0);
            Vector2 v11 = fun.Polar(v10, pi / 3, dconms / 2.0);
            Vector2 v12 = fun.Polar(p2, pi / 2 + pi/4, dc*1.5) ;
            Vector2 v13 = fun.Polar(v12, 0, dc/4.0);
            Vector2 v14 = fun.Polar(v13, 0, dc / 4.0);
            Vector2 v15 = fun.Polar(p40, pi / -2, dc*1.5);
            Vector2 v16 = fun.Polar(p40, pi / -4, 1 * 1.7 * scale);
            Vector2 v17 = fun.Polar(v16, pi / -4, dconms);
            Vector2 v18 = fun.Polar(v17, pi / -2, 2 * scale);
            Vector2 v19 = fun.Polar(v2, pi + pi / 4, 1 * 1.7 * scale);
            Vector2 v20 = fun.Polar(v19, pi + pi / 4, dconms);
            Vector2 v21 = fun.Polar(v20, pi / -2, 2 * scale);
            Vector2 v22 = fun.Polar(p15, pi / -4 - 10 * pi / 180, 1 * 1.7 * scale);
            Vector2 v23 = fun.Polar(v22, pi / -4 - 10 * pi / 180, dconms);
            Vector2 v24 = fun.Polar(v23, pi / -2, 2 * scale);
            Vector2 v25 = fun.Polar(p0, pi + pi / 4, 1 * 1.7 * scale);
            Vector2 v26 = fun.Polar(v25, pi + pi / 4, dconms);
            Vector2 v27 = fun.Polar(v26, pi / -2, 2 * scale);


            fun.dimrot1(dxf, p1, p6,0, dc/2, 2, 2 * scale, 2.4 * scale, 0.9, "SD_3", "", "");
            fun.dimrot1(dxf, p1, p8, 0, dc/2 +10, 2, 2 * scale, 2.4 * scale, 0.9, "LH", "", "");          
            fun.dimrot1(dxf, p1, v1, 0, dc/2 +20 , 2, 2 * scale, 2.4 * scale, 0.9, "LU", "", "");
            fun.dimrot1(dxf, p2 , v2, 0, dc/2 +30 , 2, 2 * scale, 2.4 * scale, 0.9, "LTA", "", "");
            fun.dimrot1(dxf, p0, v2 , 0, dc/2 +40, 2, 2 * scale, 2.4 * scale, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, p0, p40, 0, dc/2 +50, 2, 2 * scale, 2.4 * scale, 0.9, "OAL", "", "");

            fun.dimrot1(dxf, p42, p49, -90, dc /2.0, 2, 2 * scale, 2.4 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, p48, p50, 180, dc /2.0, 2, 2 * scale, 2.4 * scale, 0.9, "LS", "", "");
            fun.dimrot1(dxf, p15, p50, 180, dc , 2, 2 * scale, 2.4 * scale, 0.9, "LF", "", "");
            fun.dimrot1(dxf, p16, p15, 180, dc-((p15.Y -p16.Y )/2.0-(p15.Y -p50.Y )/2.0) , 2, 2 * scale, 2.4 * scale, 0.9, "PL,SD_1", "", "");
            fun.dimrot1(dxf, p2, p15 , 90, dc / 3.0, 2, 2 * scale, 2.4 * scale, 0.9, "DC_1", "", "");
            fun.dimrot1(dxf, p51_10, p59_10, 90, dc / 30.0, 2, 2 * scale, 2.4 * scale, 0.9, "PHD", "", "");

            fun.dimrot1(dxf, p1_, p2_,0, dc, 2, 2 * scale, 2.4 * scale, 0.9, "PL", "", "");
            fun.dimrot1(dxf, p2_, p3_, 0, dc*1.2, 2, 2 * scale, 2.4 * scale, 0.9, "SDL_1", "", "");
            fun.dimrot1(dxf, p4_, p5_, 0, dc*1.5, 2, 2 * scale, 2.4 * scale, 0.9, "SDL_2", "", "");
            fun.dimrot1(dxf, p6_, p7_, 0, dc * 1.8, 2, 2 * scale, 2.4 * scale, 0.9, "SDL_3", "", "");
            fun.dimrot1(dxf, p1_, p16_, 90, dc*1.7 , 2, 2 * scale, 2.4 * scale, 0.9, "DCINTF", "", "");
            fun.dimrot1(dxf, p2_, p15_, 90, dc * 2.2, 2, 2 * scale, 2.4 * scale, 0.9, "DC_1", "", "");
            fun.dimrot1(dxf, p4_, p13_, 90, dc * 3.4, 2, 2 * scale, 2.4 * scale, 0.9, "DC_2", "", "");
            fun.dimrot1(dxf, p6_, p11_, 90, dc * 4.6, 2, 2 * scale, 2.4 * scale, 0.9, "DC_3", "", "");
            fun.dimrot1(dxf, p16_ , p13_, 180, dc, 2, 2 * scale, 2.4 * scale, 0.9, "SD_2", "", "");
            fun.dimrot1(dxf, p16_ , p11_ , 180, dc * 1.2, 2, 2 * scale, 2.4 * scale, 0.9, "SD_3", "", "");
            fun.jdbz2(dxf, new Line(p12, p11), new Line(p5, p6), dc , 2 * scale, 2.4 * scale, 0.9, "STA_3", "", "");
            fun.jdbz2(dxf, new Line(p12_, p11_), new Line(p5_, p6_), dc*2, 2 * scale, 2.4 * scale, 0.9, "STA_3", "", "");
            fun.jdbz2(dxf, new Line(p14_, p13_), new Line(p3_, p4_), dc*3, 2 * scale, 2.4 * scale, 0.9, "STA_2", "", "");
            fun.jdbz2(dxf, new Line(p15_, p16_), new Line(p2_, p1_), dc/2.0, 2 * scale, 2.4 * scale, 0.9, "SIG", "", "");
            fun.Singlelinearrow(dxf, "CCMS", v9, 60, v10,v11, 2 * scale, 2.4 * scale);
            fun.Singlelinearrow(dxf, "FDP", v12, 180, v13, v14, 2 * scale, 2.4 * scale);
            fun.Axis(dxf, v15 , 0, -90, "Z", "X", "Y", 1 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p40 , 0, -90, "", "", "", 1 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, v2, 0, -90, "", "", "", 1 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p0 , 0, -90, "", "", "", 1 * scale, 1.2 * scale, 0);
            Circle circle1 = new Circle(Pus.ToV3 (p15,0), 1*1.7*scale );
            Line line6 = new Line(v3, v4 );
            line6.Lineweight = Lineweight.W35;//Lineweight指线宽
            line6.Layer = additionalline;//Layer指图层
            line6.LinetypeScale = 10 / scale ;//指线性比例
            line6.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line6); //提取

            Line line7 = new Line(v4, v5);
            line7.Lineweight = Lineweight.W35;//Lineweight指线宽
            line7.Layer = additionalline;//Layer指图层
            line7.LinetypeScale = 10 / scale ;//指线性比例
            line7.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line7); //提取

            Line line8 = new Line(v3, v6);
            line8.Lineweight = Lineweight.W35;//Lineweight指线宽
            line8.Layer = additionalline;//Layer指图层
            line8.LinetypeScale = 10 / scale ;//指线性比例
            line8.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line8); //提取

            Line line9 = new Line(v6, v7);
            line9.Lineweight = Lineweight.W35;//Lineweight指线宽
            line9.Layer = additionalline;//Layer指图层
            line9.LinetypeScale = 10 / scale ;//指线性比例
            line9.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line9); //提取

            Line line10 = new Line(v7, v8);
            line10.Lineweight = Lineweight.W35;//Lineweight指线宽
            line10.Layer = additionalline;//Layer指图层
            line10.LinetypeScale = 10 / scale ;//指线性比例
            line10.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line10); //提取

            Line line11 = new Line(p0_1 , p0_2 );
            line11.Lineweight = Lineweight.W25;//Lineweight指线宽
            line11.Layer = center;//Layer指图层
            line11.LinetypeScale = 10 / scale ;//指线性比例
            line11.Linetype = Linetype.DashDot ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line11); //提取

            Line line16 = new Line(p0_1_, p0_2_);
            line16.Lineweight = Lineweight.W25;//Lineweight指线宽
            line16.Layer = center;//Layer指图层
            line16.LinetypeScale = 10 / scale;//指线性比例
            line16.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line16); //提取
            Line line12 = new Line(v16, v17);
            Text txt1 = new Text("PCS", v18, 2 * scale, 0);
            Line line13 = new Line(v19, v20);
            Text txt2 = new Text("MCS", v21, 2 * scale, 0);
            Line line14 = new Line(v22, v23);
            Text txt3 = new Text("CRP", v24, 2 * scale, 0);
            Line line15 = new Line(v25, v26);
            Text txt4 = new Text("CIP", v27, 2 * scale, 0);
            dxf.AddEntity(new EntityObject[] { line12,line13 ,line14 ,line15 
                , txt1,txt2 ,txt3 ,txt4 
                ,circle1 
            });


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);

            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        //图F.89  ISYC_308_07-可转位刀片心轴连接三面刃轮廓槽铣刀
        public static void Contourgroovemillingcutter(Dictionary<string, Object> data)  //  可转位刀片心轴连接三面刃轮廓槽铣刀
        {

            DxfDocument dxf = new DxfDocument();
            dxf.Layers["0"].Lineweight = Lineweight.W25;
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            // double sl_ = Convert.ToDouble(data["oal"]);
            double scale = Convert.ToDouble(data["scale"]);
            // double sl_ = 45;
           /* double scale = 1;
            
            double cw = 13;
            double dc = 90.5;
            double lta = 30.7;
            double oal = 31.2;
            double dhub = 27.66;
            double dconms = 13.83;
            double kapr = 90;
            double kapr_ = kapr * pi / 180;*/
            //Convert.ToDouble(data[""])
            double cw = Convert.ToDouble(data["cw"]);
            double dc = Convert.ToDouble(data["dc"]);
            double lta = Convert.ToDouble(data["lta"]);
            double oal = Convert.ToDouble(data["oal"]);
            double dhub = Convert.ToDouble(data["dhub"]);
            double dconms = Convert.ToDouble(data["dconms"]);
            double kapr = Convert.ToDouble(data["kapr"]);
            double kapr_ = kapr * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, lta + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, lta + 5);
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 2.0 - dc / 40.0);
            Vector2 p2 = fun.Polar(p0, pi / -2 - 0.0001 * pi / 180, dc / 2.0 - dc / 40.0);
            Vector2 p3_1 = fun.Polar(p1, pi / 2 + kapr_ + 15 * pi / 180, dc);
            Vector2 p3_2 = fun.Polar(p0, pi, cw - 3.15 / 13 * cw);
            Vector2 p3_3 = fun.Polar(p3_2, pi / 2 + 0.0001 * pi / 180, dc);
            Vector2 p3 = fun.Inters(p3_2, p3_3, p1, p3_1);
            Vector2 p4 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p5_0 = fun.Polar(p0, 0, oal - cw);
            Vector2 p5 = fun.Polar(p5_0, pi / 2, dhub / 2.0);

            Vector2 p0_3 = fun.Polar(p5, pi / -2, dhub / 4.0);
            Vector2 p0_4 = fun.Polar(p0_3, pi, lta);
            Vector2 p0_5 = fun.Polar(p5, pi / -2, dhub / 4.0 * 3);
            Vector2 p0_6 = fun.Polar(p0_5, pi, lta);

            Vector2 p6_0 = fun.Polar(p5, pi, dc);
            Vector2 p6 = fun.Inters(p1, p2, p5, p6_0);
            Vector2 p7 = fun.Inters(p3, p4, p5, p6_0);
            Vector2 p8 = fun.Polar(p7, pi, 2 / 31.2 * oal - 1 / 31.2 * oal);
            Vector2 p9 = fun.Polar(p8, pi + pi / 4, Math.Sqrt(Math.Pow(1 / 31.2 * oal, 2) + Math.Pow(1 / 27.66 * dhub, 2)));
            Vector2 p10 = fun.mirrorpoint(p9, p0_1, p0_2);
            Vector2 p11 = fun.mirrorpoint(p8, p0_1, p0_2);
            Vector2 p12 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p13 = fun.mirrorpoint(p6, p0_1, p0_2);
            Vector2 p14 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p15 = fun.Inters(p3, p4, p0_1, p0_2);
            Vector2 p16_0 = fun.Polar(p15, pi / 2, 0.27 / 90.5 * dc);
            Vector2 p17 = fun.Polar(p16_0, pi + 15 * pi / 180, fun.CalDistance(p15, p16_0) * 2.5);
            Vector2 p18 = fun.Polar(p17, (pi * 2 - fun.CalAngle(p4, p2)) / 2, fun.CalDistance(p17, p16_0) * 20);
            Vector2 p16 = fun.Inters(p16_0, p15, p17, p18);
            Vector2 p19 = fun.Polar(p17, fun.CalAngle(p17, p18) + 77 * pi / 180, fun.CalDistance(p17, p16_0) * 4);
            Vector2 p20_1 = fun.Polar(p17, fun.CalAngle(p17, p18), fun.CalDistance(p17, p18) / 2.0);
            Vector2 p20_2 = fun.Polar(p20_1, fun.CalAngle(p17, p18) + pi / 2, dc);
            Vector2 p20 = fun.mirrorpoint(p19, p20_1, p20_2);
            Vector2 p21 = fun.Polar(p20_1, fun.CalAngle(p17, p18), fun.CalDistance(p15, p16_0) / 1.5);
            Vector2 p22_0 = fun.Polar(p21, fun.CalAngle(p18, p17) - 77 * pi / 180, dc);
            Vector2 p22 = fun.Inters(p19, p20, p22_0, p21);
            Vector2 p23 = fun.mirrorpoint(p22, p20_1, p20_2);
            Vector2 p24 = fun.Polar(p20_1, fun.CalAngle(p18, p17), fun.CalDistance(p15, p16_0) / 1.5);

            Vector2 p25_0 = fun.Inters(p0_1, p0_2, p1, p2);
            Vector2 p25_1 = fun.Polar(p25_0, pi / 2, dc);
            Vector2 p25 = fun.Inters(p17, p18, p25_0, p25_1);
            Vector2 p26 = fun.Inters(p23, p20, p1, p2);
            Vector2 p27 = fun.Inters(p3, p4, p19, p22);
            Vector2 p28_0 = fun.Polar(p4, 0, 2.23 / 13 * cw);
            Vector2 p28 = fun.Polar(p28_0, pi / 2, 2.23 / 13 * cw);
            Vector2 p29 = fun.Polar(p2, fun.CalAngle(p4, p2), Math.Sqrt(Math.Pow(1.43 / 13 * cw, 2) + Math.Pow(1.62 / 90.5 * dc, 2)));
            Vector2 p30 = fun.Polar(p29, pi, cw * 2.0 / 3.0);
            Vector2 p31 = fun.Polar(p30, pi / 3, cw * 2 / 3.0);
            Vector2 a = fun.Polar(p28, fun.CalAngle(p30, p31) - pi / 2, dc);
            Vector2 b = fun.Inters(p30, p31, p28, a);
            Circle circle1 = new Circle(Pus.ToV3(p28, 0), fun.CalDistance(p28, b));//圆
            Vector2 p32 = fun.mirrorpoint(p28, p0_1, p0_2);
            Vector2 p33 = fun.mirrorpoint(p29, p0_1, p0_2);
            Vector2 p34 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p35 = fun.mirrorpoint(p31, p0_1, p0_2);
            Circle circle2 = new Circle(Pus.ToV3(p32, 0), circle1.Radius);//圆
            Circle circle3 = new Circle(Pus.ToV3(p32, 0), circle1.Radius / 4.0);
            Vector2 p36 = fun.Polar(p28, pi / 2, circle1.Radius);
            Vector2 p37 = fun.Polar(p28, pi / -2 - 1 * pi / 180, circle1.Radius);
            Arc arc1 = fun.DrawArc(p36, p28, p37);
            Vector2 p38 = fun.Inters1(fun.Polar(p3, pi, 0.01), p4, arc1, 0);
            Vector2 p39 = fun.Polar(p28, pi / -2 + 1 * pi / 180, circle1.Radius);
            Arc arc2 = fun.DrawArc(p39, p28, p36);
            Vector2 p40 = fun.Inters1(p2, p4, arc2, 1);
            Vector2 p41 = fun.Inters(p2, p4, p30, p31);
            Vector2 p42 = fun.Inters(p1, p2, p31, p29);

            Vector2 p43 = fun.mirrorpoint(p28, p0_1, p0_2);
            Vector2 p44 = fun.mirrorpoint(p40, p0_1, p0_2);
            Vector2 p45 = fun.mirrorpoint(p41, p0_1, p0_2);
            Vector2 p46 = fun.mirrorpoint(p42, p0_1, p0_2);
            Vector2 p47 = fun.mirrorpoint(p38, p0_1, p0_2);

            Vector2 p48 = fun.Polar(p26, pi / 2, 1.62 / 90.5 * dc);
            Vector2 p49_0 = fun.Polar(p48, pi / 2, 4.99 / 90.5 * dc);
            Vector2 p49 = fun.Polar(p49_0, pi, 3.94 / 31.2 * oal);
            Vector2 p50 = fun.Polar(p49, pi / 2, 3.948 / 90.5 * dc);
            Vector2 p51 = fun.Polar(p7, pi / 2, 3.9 / 90.5 * dc);

            Vector2 p52 = fun.Polar(p32, pi / 2, arc1.Radius);
            Vector2 p53 = fun.Polar(p32, pi / -2 - 0.001 * pi / 180, arc1.Radius);
            Vector2 p54 = fun.Polar(p32, pi / -2 + 0.001 * pi / 180, arc1.Radius);

            Vector2 p55 = fun.Polar(p32, pi / 2, circle1.Radius / 4.0);
            Vector2 p56 = fun.Polar(p32, pi / -2 - 0.001 * pi / 180, circle1.Radius / 4.0);
            Vector2 p57 = fun.Polar(p32, pi / -2 + 0.001 * pi / 180, circle1.Radius / 4.0);
            Arc arc3 = fun.DrawArc(p38, p28, p40);
            Arc arc4 = fun.DrawArc(p52, p32, p53);
            Arc arc5 = fun.DrawArc4(p57, circle3.Radius, p56, 1);
            Arc arc7 = fun.DrawArc(p54, p32, p52);

            Line line1 = new Line(p40, p41);
            var polyline1 = Pus.AddPointsToLwPolyLine(p41, p30, p29, p42);
            var poluline2 = Pus.AddPointsToLwPolyLine(p34, p35, p33, p34);
            var poluline3 = Pus.AddPointsToLwPolyLine(p47, p27, p19, p17, p16, p4, p2, p25, p18, p20, p26, p46, p35, p45, p44);//注
            var poluline4 = Pus.AddPointsToLwPolyLine(p18, p17, p19, p22, p21, p24, p23, p20, p18);
            var poluline5 = Pus.AddPointsToLwPolyLine(p7, p8, p9, p10, p11, p12, p4, p2, p13, p14, p5, p6);
            var poluline6 = Pus.AddPointsToLwPolyLine(p48, p49, p50, p51);
            poluline5.Vertexes[1].Bulge = Math.Tan((pi / 2) / 4);
            poluline5.Vertexes[3].Bulge = Math.Tan((pi / 2) / 4);
            poluline6.Vertexes[0].Bulge = -Math.Tan((83 * pi / 180) / 4);
            poluline6.Vertexes[2].Bulge = Math.Tan((127 * pi / 180) / 4);

            dxf.AddEntity(new EntityObject[] { polyline1 ,poluline2 ,circle2,circle3,poluline3 ,poluline4 ,poluline5,poluline6
            ,arc3
            ,line1
            });
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, poluline2, 0.5, contour);
            fun.PolyFill(dxf, poluline3, 0.5, contour);
            fun.PolyFill(dxf, poluline4, 0.5, contour);
            fun.PolyFill(dxf, poluline5, 0.5, contour);
            fun.PolyFill(dxf, poluline6, 0.5, contour);
            fun.drawBArc(dxf, arc3, 0.5, contour);
            fun.drawBArc(dxf, arc4, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc7, 0.5, contour);
            Line line2 = new Line(p0_1, p0_2);
            line2.Lineweight = Lineweight.W25;//Lineweight指线宽
            line2.Layer = center;//Layer指图层
            line2.LinetypeScale = 5;//指线性比例
            line2.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line2); //提取

            Line line3 = new Line(p0_3, p0_4);
            line3.Lineweight = Lineweight.W35;//Lineweight指线宽
            line3.Layer = refin;//Layer指图层
            line3.LinetypeScale = 5;//指线性比例
            line3.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line3); //提取
            Line line4 = new Line(p0_5, p0_6);
            line4.Lineweight = Lineweight.W35;//Lineweight指线宽
            line4.Layer = refin;//Layer指图层
            line4.LinetypeScale = 5;//指线性比例
            line4.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line4); //提取

            //标注
            /* fun.dimrot1(dxf, p1, p18, 90, dc, 2, 2 * scale, 2.4 * scale, 0.9, "DCB", "", "");
          fun.jdbz2(dxf, new Line(p4, p5), new Line(p7, p8), dc, 2 * scale, 2.4 * scale, 0.9, "SIG", "", "");
          fun.Axis(dxf, fun.Polar(p0, pi + pi / 3, dc * 2), 180, -90, "Z", "X", "Y", 1 * scale, 2 * scale, 0);
          fun.Axis(dxf, p0, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
          fun.Axis(dxf, p19, 180, -90, "", "", "", 1 * scale, 2 * scale, 0);
          fun.Singlelinearrow(dxf, "CCMS", v1, 110, fun.Polar(v1, 110 * pi / 180, dc / 2.0), fun.Polar(v1, 110 * pi / 180, dc), 1.2 * scale, 1.6 * scale);
        */
            Vector2 v1 = fun.Polar(p32, pi, arc1.Radius);
            Vector2 v2 = fun.Polar(p28, pi, arc1.Radius);
            Vector2 v3 = fun.Polar(p51, pi / -2, fun.CalDistance(p51, p7));
            Vector2 v4 = fun.Polar(v1, pi / 2, 0.1);

            Vector2 v5 = fun.Polar(p0_5, 0, 3);
            Vector2 v6 = fun.Polar(v5, pi / -3, cw / 2.0);
            Vector2 v7 = fun.Polar(v6, pi / -3, cw / 2.0);
            Vector2 v8 = fun.Polar(p32, pi - pi / 4, oal);
            Vector2 v9 = fun.Polar(v8, pi / -2, cw / 2.0);
            Vector2 v10 = fun.Polar(v9, pi / -2, cw / 2.0);
            Vector2 v11 = fun.Polar(p5, pi / -2, dhub / 2.0);
            Vector2 v12 = fun.Polar(p9, pi / -2, fun.CalDistance(p9, p10) / 2.0);
            Vector2 v13 = fun.Polar(v11, pi / -2 - 10 * pi / 180, 0.5 * 1.7 * scale);
            Vector2 v14 = fun.Polar(v13, pi / -2 - 10 * pi / 180, dhub / 1.5);
            Vector2 v15 = fun.Polar(v14, pi / -2, 1.2 * scale);
            Vector2 v16 = fun.Polar(v12, pi + 80 * pi / 180, 0.5 * 1.7 * scale);
            Vector2 v17 = fun.Polar(v16, pi + 80 * pi / 180, dhub / 1.5);
            Vector2 v18 = fun.Polar(v17, pi / -2, 1.2 * scale);

            Vector2 v19 = fun.Polar(v1, pi / 2, dc);
            Vector2 v20 = fun.Polar(p34, pi, dc);
            Vector2 v21 = fun.Inters(v1, v19, v20, p34);
            Vector2 v22 = fun.Polar(v21, pi / 2 + pi / 4, 0.5 * 1.7 * scale);
            Vector2 v23 = fun.Polar(v22, pi / 2 + pi / 4, cw);

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.dimrot1(dxf, p5, v1, 0, oal, 2, 1.2 * scale, 1.6 * scale, 0.9, "LTA,LF", "", "");
            fun.dimrot1(dxf, p5, p9, 0, oal * 1.8, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL,THUB,LPR", "", "");
            fun.dimrot1(dxf, p29, v2, 180, oal / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "CW,APMX", "", "");
            fun.dimrot1(dxf, p33, p29, 90, oal * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p33, v3, 90, oal, 2, 1.2 * scale, 1.6 * scale, 0.9, "CDX", "", "");
            fun.dimrot1(dxf, p0_3, p0_5, -90, oal, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, p5, p14, -90, oal * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DHUB", "", "");
            fun.jdbz2(dxf, new Line(p34, p33), new Line(v1, v4), oal / 3.0, 1.2 * scale, 1.6 * scale, 0.9, "KAPR", "", "");
            fun.Singlelinearrow(dxf, "CCMS", v5, -60, v6, v7, 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v8, 90, v9, v10, 1.2 * scale, 1.6 * scale);
            fun.Axis(dxf, fun.Polar(p14, pi / -3, oal), 0, -90, "Z", "X", "Y", 0.5, 1.2 * scale, 0);
            fun.Axis(dxf, v11, 0, -90, "", "", "", 0.5, 1.2 * scale, 0);
            fun.Axis(dxf, v12, 0, -90, "", "", "", 0.5, 1.2 * scale, 0);
            Line linev1 = new Line(v13, v14);
            Text txt1 = new Text("PCS,MCS", v15, 1.2 * scale, 0);
            Line linev2 = new Line(v16, v17);
            Text txt2 = new Text("CIP", v18, 1.2 * scale, 0);
            Line linev3 = new Line(v22, v23);
            Text txt3 = new Text("CRP", v23, 1.2 * scale, 0);
            Circle circle4 = new Circle(Pus.ToV3(v22, 0), 0.5 * 1.7 * scale);//圆
            dxf.AddEntity(new EntityObject[]{ linev1,linev2 ,linev3
                ,txt1,txt2  ,txt3
                ,circle4
            });

            fun.SetLayer(dxf);
            fun.SetByLayer(dxf);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        //图F.90 ISYC_308_08-可转位刀片心轴连接三面刃单角槽铣刀
        public static void Singleanglegroovemillingcutter1(Dictionary<string, Object> data)  //  可转位刀片心轴连接三面刃单角槽铣刀
        {

            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
             double sl_ = Convert.ToDouble(data["dc"]);
              double scale = Convert.ToDouble(data["scale"]);
            //double sl_ = 45;
            //double scale = 1;
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            /*
            double dhub = 40*scale ;
            double thub = 26 * scale;
            double oal = 26.5 * scale;
            double dc = 120 * scale;
            double dcn = 110 * scale;

            double kapr = 70;
            */
            double dhub = Convert.ToDouble(data["dhub"]) * scale;
            double thub = Convert.ToDouble(data["thub"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double dcn = Convert.ToDouble(data["dcn"]) * scale;

            double kapr = Convert.ToDouble(data["kapr"]);
            double kapr_ = kapr * pi / 180;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, oal - thub);
            Vector2 p0_2 = fun.Polar(p0, 0, oal);
            Vector2 p1 = fun.Polar(p0, pi / 2, dhub / 2.0);
            Vector2 p2 = fun.mirrorpoint(p1, p0_1, p0_2);
            Vector2 p3 = fun.Polar(p1, 0, thub);
            Vector2 p4 = fun.mirrorpoint(p3, p0_1, p0_2);
            Vector2 p5 = new Vector2(thub / 9.0, dcn / 2.0);
            Vector2 p6 = fun.mirrorpoint(p5, p0_1, p0_2);
            Vector2 p7 = fun.Polar(p5, (pi / 2 - kapr_), ((dc - dcn) / 2.0) / Math.Sin((pi / 2 - kapr_)));
            Vector2 p8 = fun.mirrorpoint(p7, p0_1, p0_2);
            Vector2 p9 = fun.Inters(p5, p6, p1, p3);
            Vector2 p10 = fun.Inters(p2, p4, p5, p6);
            Vector2 p11 = fun.Inters(p7, p8, p1, p3);
            Vector2 p12 = fun.Inters(p2, p4, p7, p8);
            Vector2 p13 = fun.Polar(p7, fun.CalAngle(p7, p5), fun.CalDistance(p7, p5) / 2.0);
            Vector2 p14 = fun.Polar(p13, fun.CalAngle(p13, p7) - pi / 3, fun.CalDistance(p13, p7) / 1.5);
            Vector2 p15 = fun.mirrorpoint(p13, p0_1, p0_2);
            Vector2 p16 = fun.mirrorpoint(p14, p0_1, p0_2);
            Vector2 p17 = fun.Polar(p13, fun.CalAngle(p14, p13) + pi / 2, 0.5 / 7.3 * fun.CalDistance(p7, p13));
            Vector2 p18_1 = fun.Polar(p17, fun.CalAngle(p14, p13), dc);
            Vector2 p18 = fun.Polar(p13, fun.CalAngle(p7, p13) - pi / 2, 0.5 / 7.3 * fun.CalDistance(p7, p13));
            Vector2 p19_1 = fun.Polar(p18, fun.CalAngle(p7, p13), dc);
            Vector2 p19 = fun.Inters(p17, p18_1, p19_1, p18);
            Vector2 p20 = fun.Polar(p14, fun.CalAngle(p14, p7) - pi / 2, 0.5 / 4.873 * fun.CalDistance(p13, p14));
            Vector2 p21_1 = fun.Polar(p19, fun.CalAngle(p13, p14), dc);
            Vector2 p21_2 = fun.Polar(p20, fun.CalAngle(p7, p14), dc);
            Vector2 p21 = fun.Inters(p20, p21_2, p19, p21_1);
            Vector2 p22_1 = fun.Polar(p19, fun.CalAngle(p13, p7), dc);
            Vector2 p22_2 = fun.Polar(p21, fun.CalAngle(p14, p7), dc);
            Vector2 p22 = fun.Inters(p22_1, p19, p22_2, p21);
            Vector2 p23 = fun.Inters(p22, p21, p7, p8);
            Vector2 p24 = fun.mirrorpoint(p19, p0_1, p0_2);
            Vector2 p25 = fun.mirrorpoint(p22, p0_1, p0_2);
            Vector2 p26 = fun.mirrorpoint(p21, p0_1, p0_2);
            Vector2 p27 = fun.Inters(p24, p26, p6, p8);
            Vector2 p28 = fun.Inters(p7, p8, p25, p26);
            Vector2 p29_0 = fun.Polar(p0, pi, oal - thub);
            Vector2 p29 = fun.Polar(p29_0, pi / 2, p5.Y / 3.0 * 2);
            Vector2 p30 = fun.Polar(p29, fun.CalAngle(p19, p21), fun.CalDistance(p19, p21));
            Vector2 p31 = fun.Polar(p30, fun.CalAngle(p21, p22), fun.CalDistance(p21, p22));
            Vector2 p32 = fun.Polar(p29, fun.CalAngle(p19, p13), fun.CalDistance(p19, p13));
            Vector2 p33 = fun.Polar(p32, fun.CalAngle(p13, p14), fun.CalDistance(p13, p14));
            Vector2 p34 = fun.Polar(p32, fun.CalAngle(p13, p7), fun.CalDistance(p13, p7));
            Vector2 p35 = fun.Inters(p29, p30, p5, p6);
            Vector2 p36 = fun.Inters(p29, p31, p5, p6);
            Vector2 p37 = fun.mirrorpoint(p29, p0_1, p0_2);
            Vector2 p38 = fun.mirrorpoint(p30, p0_1, p0_2);
            Vector2 p39 = fun.mirrorpoint(p31, p0_1, p0_2);
            Vector2 p40 = fun.mirrorpoint(p32, p0_1, p0_2);
            Vector2 p41 = fun.mirrorpoint(p33, p0_1, p0_2);
            Vector2 p42 = fun.mirrorpoint(p34, p0_1, p0_2);
            Vector2 p43 = fun.Inters(p5, p6, p37, p38);
            Vector2 p44 = fun.Inters(p5, p6, p37, p39);
            Vector2 p45 = fun.Polar(p22, pi / -2, dc / 2.0);
            Vector2 p46 = fun.Polar(p45, fun.CalAngle(p22, p21), fun.CalDistance(p22, p21));
            Vector2 p47_1 = fun.Polar(p46, fun.CalAngle(p21, p19), dc);
            Vector2 p47_2 = fun.Polar(p45, fun.CalAngle(p22, p19), dc);
            Vector2 p47 = fun.Inters(p45, p47_2, p46, p47_1);
            Vector2 p48 = fun.Inters(p7, p8, p46, p45);
            Vector2 p49 = fun.Inters(p7, p8, p47, p45);
            Vector2 p50_1 = fun.Polar(p46, fun.CalAngle(p46, p45) + pi / 2, 0.05 / 0.6577 * fun.CalDistance(p47, p46));
            Vector2 p50_2 = fun.Polar(p50_1, fun.CalAngle(p46, p45), dc);
            Vector2 p50_3 = fun.Polar(p47, fun.CalAngle(p47, p46) + pi / 2, 0.05 / 0.6577 * fun.CalDistance(p47, p46));
            Vector2 p50_4 = fun.Polar(p50_3, fun.CalAngle(p47, p46), dc);
            Vector2 p50_5 = fun.Polar(p47, fun.CalAngle(p47, p45) - pi / 2, 0.05 / 0.6577 * fun.CalDistance(p47, p46));
            Vector2 p50_6 = fun.Polar(p50_5, fun.CalAngle(p47, p45), dc);
            Vector2 p50 = fun.Inters(p50_1, p50_2, p50_3, p50_4);
            Vector2 p51 = fun.Inters(p50_3, p50_4, p50_5, p50_6);
            Vector2 p52 = fun.Inters(p50_1, p50_2, p50_5, p50_6);
            Vector2 p53 = fun.Polar(p21, fun.CalAngle(p21, p22), fun.CalDistance(p21, p22) / 2.0);
            Vector2 p54 = fun.Polar(p19, fun.CalAngle(p19, p22), fun.CalDistance(p19, p22) / 2.0);
            Vector2 p55 = fun.Inters(p19, p53, p21, p54);
            Vector2 p56 = fun.Polar(p32, fun.CalAngle(p13, p55), fun.CalDistance (p13, p55));
            Vector2 p57 = fun.mirrorpoint(p56, p0_1, p0_2);
            Vector2 p58 = fun.Polar(p51, fun.CalAngle(p13, p55), fun.CalDistance(p13, p55));
            var polyline1 = Pus.AddPointsToLwPolyLine(p5, p17, p19, p22, p21, p19, p22, p23, p11, p3, p4, p12, p48, p46, p47, p45, p46, p47, p49, p11, p49, p45, p48, p8, p28, p25, p24, p27, p8, p6,
                p44, p37, p38, p39, p37, p43, p10, p2, p1, p9, p10, p35, p29, p31, p30, p29, p36, p5);
            var polyline2 = Pus.AddPointsToLwPolyLine(p19, p22, p21, p19);
            var polyline3 = Pus.AddPointsToLwPolyLine(p13, p7, p14, p13);
            var polyline4 = Pus.AddPointsToLwPolyLine(p32, p33, p34, p32);
            var polyline5 = Pus.AddPointsToLwPolyLine(p40, p41, p42, p40);
            var polyline6 = Pus.AddPointsToLwPolyLine(p50, p51, p52, p50);
            Circle circle2 = new Circle(Pus.ToV3(p55, 0),fun .CalDistance (p13,p14)/8.0);//圆
            Circle circle3 = new Circle(Pus.ToV3(p56, 0), fun.CalDistance(p13, p14) / 8.0);//圆
            Circle circle4 = new Circle(Pus.ToV3(p57, 0), fun.CalDistance(p13, p14) / 8.0);//圆
            Circle circle5 = new Circle(Pus.ToV3(p58, 0), fun.CalDistance(p13, p14) / 8.0);//圆

            dxf.AddEntity(new EntityObject[] { polyline1 ,polyline2 ,polyline3 ,polyline4 ,polyline5 ,polyline6
                ,circle2,circle3,circle4,circle5
            });
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.PolyFill(dxf, polyline3, 0.5, contour);
            fun.PolyFill(dxf, polyline4, 0.5, contour);
            fun.PolyFill(dxf, polyline5, 0.5, contour);
            fun.PolyFill(dxf, polyline6, 0.5, contour);
            //标注
           
            Vector2 v1 = fun.Polar(p9, pi / 2, dc / 4.0);
            Vector2 v0_1 = fun.Polar(p0, pi / 2, dhub / 4);
            Vector2 v0_2 = fun.Polar(v0_1, 0, oal);
            Vector2 v0_3 = fun.Polar(p0, pi / -2, dhub / 4);
            Vector2 v0_4 = fun.Polar(v0_3, 0, oal);
            Vector2 v2 = fun.Polar(v0_4, 0, oal / 4.0);
            Vector2 v3 = fun.Polar(v2, -80 * pi / 180, oal / 2.0);
            Vector2 v4 = fun.Polar(v3, -80 * pi / 180, oal / 2.0);
            Vector2 v5 = fun.Polar(p0_1, pi / 2, dc / 2.0);
            Vector2 v6 = fun.Polar(v5, pi - 10 * pi / 180, 0.5 * 1.7 * scale);
            Vector2 v7 = fun.Polar(v6, pi - 10 * pi / 180, oal);
            Vector2 v8 = fun.Polar(p0, pi + pi / 3, 1.7 * 0.5 * scale);
            Vector2 v9 = fun.Polar(v8, pi + pi / 3, oal / 2.0);
            Vector2 v10 = fun.Polar(v9, pi / -2, 1.2 * scale);
            Vector2 v11 = fun.Polar(p0_2, -80 * pi / 180, 1.7 * 0.5 * scale);
            Vector2 v12 = fun.Polar(v11, -80 * pi / 180, oal * 2);
            Vector2 v13 = fun.Polar(v12, pi / -2, 1.2 * scale);

          

            fun.dimrot1(dxf, p0, p0_2, 0, oal * 3.5, 2, 1.6 * scale, 2 * scale, 0.9, "OAL,LF,LTA,LPR", "", "");
            fun.dimrot1(dxf, p22, p0_1, 0, oal * 1.5, 2, 1.6 * scale, 2 * scale, 0.9, "CW,APMX", "", "");
            fun.dimrot1(dxf, p22, p25, 90, oal * 2, 2, 1.6 * scale, 2 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p7, p8, 90, oal * 1.5, 2, 1.6 * scale, 2 * scale, 0.9, "DCN", "", "");
            fun.dimrot1(dxf, p22, v1, 90, oal, 2, 1.6 * scale, 2 * scale, 0.9, "CDX", "", "");
            fun.dimrot1(dxf, p1, p3, 180, oal / 2.0, 2, 1.6 * scale, 2 * scale, 0.9, "THUB", "", "");
            fun.dimrot1(dxf, p3, p4, -90, oal, 2, 1.6 * scale, 2 * scale, 0.9, "DHUB", "", "");
            fun.dimrot1(dxf, v0_2, v0_4, -90, oal / 2.0, 2, 1.6 * scale, 2 * scale, 0.9, "DCONMS", "", "");
            fun.jdbz2(dxf, new Line(p19, p22), new Line(p0_1, fun.Polar(p0_1, pi / 2, dc / 2)), oal * 1.2, 1.6 * scale, 2 * scale, 0.9, "KAPR", "", "");
            fun.Singlelinearrow(dxf, "CCMS", v2, -80, v3, v4, 1.6 * scale, 2 * scale);
            fun.Axis(dxf, fun.Polar(p0_2, -pi / 4, oal * 1.5), 0, -90, "Z", "X", "Y", 0.5 * scale, 1.6 * scale, 1);
            fun.Axis(dxf, p0_1, 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 1);
            fun.Axis(dxf, p0_2, 0, -90, "", "", "", 0.5 * scale, 1.6 * scale, 1);
            Line linev1 = new Line(v7, v6);
            Text txt1 = new Text("CRP", v7, 1.6 * scale, 0);
            Line linev2 = new Line(v9, v8);
            Text txt2 = new Text("CIP", v10, 1.6 * scale, 0);
            Line linev3 = new Line(v11, v12);
            Text txt3 = new Text("PCS,MCS", v13, 1.6 * scale, 0);
            Circle circle1 = new Circle(Pus.ToV3(v5, 0), 0.5 * 1.7 * scale);//圆
            dxf.AddEntity(new EntityObject[] {linev1, txt1,linev2,txt2,linev3,txt3,circle1
            });
            Line line3 = new Line(v0_1 , v0_2);
            line3 .Lineweight = Lineweight.W35;//Lineweight指线宽
            line3.Layer = additionalline;//Layer指图层
            line3.LinetypeScale = 5 ;//指线性比例
            line3.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line3); //提取
            Line line4 = new Line(v0_3 , v0_4 );
            line4.Lineweight = Lineweight.W35;//Lineweight指线宽
            line4.Layer = additionalline;//Layer指图层
            line4.LinetypeScale = 5 ;//指线性比例
            line4.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line4); //提取
            Line line5 = new Line(p0_1 , p0_2 );
            line5.Lineweight = Lineweight.W25;//Lineweight指线宽
            line5.Layer = centre  ;//Layer指图层
            line5.LinetypeScale = 5 ;//指线性比例
            line5.Linetype = Linetype.DashDot ;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line5); //提取


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);                                       
        }
        //图F.91 ISYC_308_09-可转位刀片心轴连接锯片和锯片铣刀
        public static void Sawblademillingcutter1(Dictionary<string, Object> data)  //  可转位刀片心轴连接锯片和锯片铣刀
        {

            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["dc"]);
            double scale = Convert.ToDouble(data["scale"]);
           // double sl_ = 45;
           // double scale = 1;
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            /*
            double dc = 40*scale ;
            double cdx = 10 * scale;
            double dbc = 13.33 * scale;
            double dconms = 10 * scale;
            double dah = 1.335 * scale;
            double oal =  4*scale ;
            double apmx = 2.5*scale ;
               */
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double cdx = Convert.ToDouble(data["cdx"]) * scale;
            double dbc = Convert.ToDouble(data["dbc"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dah = Convert.ToDouble(data["dah"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double apmx = Convert.ToDouble(data["apmx"]) * scale;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, dc / 2.0 + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, dc / 2.0 + 5);
            Vector2 p0_5 = fun.Polar(p0, pi / 2, dc / 2.0 + 5);
            Vector2 p0_6 = fun.Polar(p0, pi / -2, dc / 2.0 + 5);
            Circle circle1 = new Circle(Pus.ToV3(p0 , 0), dc/2.0- dc / 63.0);//圆
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p2 = fun.Polar(p1, pi / -2, dc / 9.52);
            Vector2 p3 = fun.Polar(p2, fun.CalAngle(p0, p1) + pi / 2, (dc / 9.52 / 2.0));
            Vector2 p4 = fun.Polar(p3, pi / 2, fun .CalDistance (p1,p2 ) - dc / 63.0);
            Vector2 p5_0 = fun.Polar(p0, pi * 2 / 3.0, dc);
            Arc arc1 = fun.DrawArc4(fun.Polar(p0, pi / 2, circle1.Radius), circle1.Radius, fun.Polar(p0, pi / -2-0.1*pi/180, circle1.Radius),0) ;
            Vector2 p5 = fun.Inters1(p0, p5_0, arc1, 0);
            Vector2 p6 = fun.Polar(p5, -100*pi/180, fun.CalDistance(p1, p4)/2.0);
            Vector2 p7_0 = fun.Polar(p0, 135 * pi / 180, dc);
            Arc arc2 = fun.DrawArc4(p6 , fun .CalDistance (p0,p6 ), fun.Polar(p0, pi, fun.CalDistance(p0, p6)), 0);
            Vector2 p7 = fun.Inters1(p0, p7_0, arc2, 0);
            Vector2 p8 = fun.Polar(p0, pi / 2, dbc / 2.0);
            Vector2 p9 = fun.Polar(p0, 0, dbc / 2.0);
            Vector2 p10 = fun.Polar(p0, pi / -2, dbc / 2.0);
            Vector2 p11 = fun.Polar(p0, pi, dbc / 2.0);
            Vector2 p12_1 = fun.Polar(p0, pi / 2, dconms  / 2.0);
            Vector2 p12_2 = fun.Polar(p0, pi/-2, dconms  / 2.0);
            Arc arc3 = fun.DrawArc(p12_1, p0 , p12_2);
            Vector2 p12_3 = fun.Polar(p0, pi / 2 + pi / 4, dc);
            Vector2 p12 = fun.Inters1(p0, p12_3, arc3, 0);
            Circle circle9 = new Circle(Pus.ToV3(p12, 0), dah*1.5/2);//圆
            Circle circle10 = new Circle(Pus.ToV3(p0, 0), dconms/2.0);//圆
            Vector2 p13_1 = fun.Polar(p12, pi / 2, circle9.Radius);
            Vector2 p13_2 = fun.Polar(p12,pi/-2, circle9.Radius);
            Arc arc4 = fun.DrawArc(p13_1, p12 , p13_2);
            Vector2 p13 = fun.Inters4(arc4, arc3, 1);
            Vector2 p14 = fun.Inters4(arc4, arc3, 0);
            Vector2 p15 = fun.Polar(p1, 0, dc);
            Vector2 p16 = fun.Polar(p15, 0, apmx );
            Vector2 p17 = fun.Polar(p2, 0, dc );
            Vector2 p18 = fun.Polar(p17, 0, apmx );
            Vector2 p0_3 = fun.Polar(p15, pi / -2, dc / 2.0);
            Vector2 p0_4 = fun.Polar(p16, pi / -2, dc / 2.0);
            Vector2 p19_0 = fun.Polar(p15, pi / -2, apmx / 10.0);
            Vector2 p19 = fun.Polar(p19_0, 0, apmx / 10.0 );
            Vector2 p20 = fun.Polar(p19, 0, apmx - apmx / 10.0 * 2);
            Vector2 p21_0 = fun.Polar(p19, pi / -2, dc);
            Vector2 p21 = fun.Inters(p0_3, p0_4, p19, p21_0);
            Vector2 p22_0 = fun.Polar(p20, pi / -2, dc);
            Vector2 p22 = fun.Inters(p0_3, p0_4, p20, p22_0);
            Vector2 p23 = fun.Inters(p17, p18, p19, p21);
            Vector2 p24 = fun.Inters(p17, p18, p20, p22);
            Vector2 p25 = fun.Polar(p19, pi / -2, cdx - apmx / 10.0);
            Vector2 p26 = fun.Polar(p20, pi / -2, cdx - apmx / 10.0);
            Vector2 p27 = fun.Polar(p21, pi, (oal - apmx) / 2.0);
            Vector2 p28 = fun.Polar(p22, 0, (oal - apmx) / 2.0);
            Vector2 p29 = fun.Polar(p27, pi / 2, (dc - cdx * 2) / 2.0 - (((dc - cdx * 2) / 2.0) * 1 / 20));
            Vector2 p30 = fun.Polar(p28, pi / 2, (dc - cdx * 2) / 2.0 - (((dc - cdx * 2) / 2.0) * 1 / 20));
            Vector2 p31 = fun.Polar(p22, pi, apmx / 10.0);
            Vector2 p32_0 = fun.Polar(p31, pi / 2, dc);
            Vector2 p32 = fun.Inters(p31, p32_0, p19, p20);
            Vector2 p33 = fun.Polar(p21, pi / 2, fun.CalDistance(p21, p25) / 2.0);
            Vector2 p34 = fun.Polar(p22, pi / 2, fun.CalDistance(p26, p22) / 2.0);

            Vector2 p35 = fun.mirrorpoint(p15, p0_3, p0_4);
            Vector2 p36 = fun.mirrorpoint(p16, p0_3, p0_4);
            Vector2 p37 = fun.mirrorpoint(p17, p0_3, p0_4);
            Vector2 p38 = fun.mirrorpoint(p18, p0_3, p0_4);
            Vector2 p39 = fun.mirrorpoint(p19, p0_3, p0_4);
            Vector2 p40 = fun.mirrorpoint(p20, p0_3, p0_4);
            Vector2 p41 = fun.mirrorpoint(p21, p0_3, p0_4);
            Vector2 p42 = fun.mirrorpoint(p22, p0_3, p0_4);
            Vector2 p43 = fun.mirrorpoint(p23, p0_3, p0_4);
            Vector2 p44 = fun.mirrorpoint(p24, p0_3, p0_4);
            Vector2 p45 = fun.mirrorpoint(p25, p0_3, p0_4);
            Vector2 p46 = fun.mirrorpoint(p26, p0_3, p0_4);
            Vector2 p47 = fun.mirrorpoint(p27, p0_3, p0_4);
            Vector2 p48 = fun.mirrorpoint(p28, p0_3, p0_4);
            Vector2 p49 = fun.mirrorpoint(p29, p0_3, p0_4);
            Vector2 p50 = fun.mirrorpoint(p30, p0_3, p0_4);
            Vector2 p51 = fun.mirrorpoint(p31, p0_3, p0_4);
            Vector2 p52 = fun.Inters(p37, p38, p32, fun.Polar(p32, pi / -2, dc * 1.5));
            Vector2 p53 = fun.mirrorpoint(p33, p0_3, p0_4);
            Vector2 p54 = fun.mirrorpoint(p34, p0_3, p0_4);
            Vector2 p55 = fun.Polar(p29, pi / -2, fun.CalDistance(p29, p27) / 3.0);
            Vector2 p56 = fun.Polar(p55, 0, oal);
            Vector2 p57 = fun.mirrorpoint(p55, p0_3, p0_4);
            Vector2 p58 = fun.mirrorpoint(p56, p0_3, p0_4);
            Line line1 = new Line(p55, p56);
            Line line2 = new Line(p57, p58);
            line1.Layer = refin;//Layer指图层
            line1.LinetypeScale = 5 * scale;//指线性比例
            line1.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            line1.LinetypeScale = 5 / scale ;//指线性比例
            line2.Layer = refin;//Layer指图层
            line2.LinetypeScale = 5 * scale;//指线性比例
            line2.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            line2.LinetypeScale = 5 / scale ;//指线性比例

            Arc arc5 = fun.DrawArc4(p14, circle9.Radius, p13, 0);
            Arc arc6 = fun.DrawArc(p13, p0, p14);
            Circle circle4 = new Circle(Pus.ToV3(p0, 0), dbc /2.0);//圆
            circle4.Layer = refin;//Layer指图层
            circle4.LinetypeScale = 5 *scale;//指线性比例
            circle4 .Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(circle4);
            Circle circle5 = new Circle(Pus.ToV3(p8 , 0), dah  / 2.0);//圆
            Circle circle6 = new Circle(Pus.ToV3(p9, 0), dah / 2.0);//圆
            Circle circle7 = new Circle(Pus.ToV3(p10, 0), dah / 2.0);//圆
            Circle circle8 = new Circle(Pus.ToV3(p11, 0), dah / 2.0);//圆



            Circle circle2 = new Circle(Pus.ToV3(p0, 0), (dc - cdx * 2) / 2.0);//圆
            Circle circle3 = new Circle(Pus.ToV3(p0, 0), (dc - cdx * 2) / 2.0 - (((dc - cdx * 2) / 2.0) * 1 / 20));//圆
            var polyline1 = Pus.AddPointsToLwPolyLine(p4,p3,p2,p1,p4,p5,p6,p7 );
            var polyline2 = Pus.AddPointsToLwPolyLine(p23, p17, p15, p16, p18, p24, p20, p19, p45, p49, p29, p25, p43, p37, p35, p36, p38,
                p44, p46, p50,p30,p26,p46,p20,p32,p52,p37,p44,p54,p53,p33,p34);
           polyline1 .Vertexes[4].Bulge = Math.Tan((pi/3 ) / 4);
            polyline1.Vertexes[6].Bulge = -Math.Tan((120*pi/180) / 4);
            
            fun.Circulararray1(dxf, polyline1, 8, 0.5, contour);
            dxf.AddEntity(new EntityObject[] {polyline2   //polyline1 
            //    ,circle2 ,circle3 ,circle4 ,circle5 ,circle6,circle7 ,circle8  
           //  ,arc5,arc6 
         ,line1,line2
            });
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
            fun.drawcircle(dxf, p0 , circle2.Radius, 0.5, contour);
            fun.drawcircle(dxf, p0, circle3.Radius, 0.5, contour);
            fun.drawcircle(dxf, p8, circle5.Radius, 0.5, contour);
            fun.drawcircle(dxf, p9, circle6.Radius, 0.5, contour);
            fun.drawcircle(dxf, p10, circle7.Radius, 0.5, contour);
            fun.drawcircle(dxf, p11, circle8.Radius, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);

            Line line3 = new Line(p0_1, p0_2);
            line3.Layer = centre;//Layer指图层
            line3.LinetypeScale = 5 * scale;//指线性比例
            line3.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
     
            Line line4 = new Line(p0_3, p0_4);
            line4.Layer = centre;//Layer指图层
            line4.LinetypeScale = 5 * scale;//指线性比例
            line4.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
            
            Line line5 = new Line(p0_5, p0_6);
            line5.Layer = centre;//Layer指图层
            line5.LinetypeScale = 5 * scale;//指线性比例
            line5.Linetype = Linetype.Dashed ;//Linetype指是点划线还是虚线什么的
  
            dxf.AddEntity(new EntityObject[] { line3, line4, line5 });

            //标注
           
            Vector2 v1 = fun.Polar(p1, pi / -2, dc);
            Vector2 v2 = fun.Polar(p0, pi, dbc / 2.0);
            Vector2 v3 = fun.Polar(v2, 0, dbc);
            Vector2 v4 = fun.Polar(p0, pi, dconms / 2.0);
            Vector2 v5 = fun.Polar(v4, 0, dconms);
            Vector2 v6 = fun.Polar(p11, pi / 2, dah / 2.0);
            Vector2 v7 = fun.Polar(v6, pi / -2, dah);
            Vector2 v8 = fun.Polar(p0, pi + pi / 3, dc);
            Vector2 v9 = fun.Polar(p28, -pi / 3, dc);
            Vector2 v10 = fun.Polar(p0, pi / 2 + pi / 4, 0.3 * 1.7 * scale);
            Vector2 v11 = fun.Polar(v10, pi / 2 + pi / 4, dc / 1.5);
            Vector2 v12 = fun.Polar(p0, pi + pi / 4, dconms / 2.0);
            Vector2 v13 = fun.Polar(v12, pi + pi / 4, dc / 2.0 / 2.0);
            Vector2 v14 = fun.Polar(v13, pi + pi / 4, dc / 2.0 / 2.0);
            Vector2 v16 = fun.Polar(p16, pi / 6, dc/1.3 );
            Vector2 v17 = fun.Polar(v16, pi / -2, dc / 2.0 / 2.0/2.0);
            Vector2 v18 = fun.Polar(v17, pi / -2, dc / 2.0 / 2.0/2.0);
            Vector2 v19 = fun.Polar(v1, pi + pi / 4, 0.3 * 1.7 * scale);
            Vector2 v20 = fun.Polar(v19, pi + pi / 4, dconms / 4.0);
            Vector2 v21 = fun.Polar(v20, pi / -2, 1.2 * scale);
            Vector2 v22 = fun.Polar(p27, pi + pi / 6, 0.3 * 1.7 * scale);
            Vector2 v23 = fun.Polar(v22, pi + pi / 6, dconms );
            Vector2 v24 = fun.Polar(v23, pi / -2, 1.2 * scale);
            Vector2 v25 = fun.Polar(p28, pi / -4, 0.3 * 1.7 * scale);
            Vector2 v26 = fun.Polar(v25, pi / -4, dconms / 2.0);
            Vector2 v27 = fun.Polar(v26, pi / -2, 1.2 * scale);
            Vector2 v28 = fun.Polar(p36, pi / 4, 0.3 * 1.7 * scale);
            Vector2 v29 = fun.Polar(v28, pi / 4, dconms / 2.0);
            Vector2 v30 = fun.Polar(p0, 0, dc / 2.0);
            Vector2 v31 = fun.Polar(v30, pi / 1.8, dc);

            fun.dimrot1(dxf, p1, v1, -90, dc/1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, v2, v3, 180, dc , 2, 1.2 * scale, 1.6 * scale, 0.9, "DBC", "", "");
            fun.dimrot1(dxf, v4, v5, 180, dc/1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, v6, v7,  90, dc / 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DAH", "", "");
            fun.dimrot1(dxf, p29, p30 , 0, dc / 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL,LPR,THUB", "", "");
            fun.dimrot1(dxf, p16, p26, -90, dc / 3, 2, 1.2 * scale, 1.6 * scale, 0.9, "CDX", "", "");
            fun.dimrot1(dxf, p16, p36, -90, dc / 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, p35, p36, 180, dc / 3.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "APMX,CW", "", "");
            fun.dimrot1(dxf, p49, p36 , 180, dc / 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LTA,LF", "", "");
            fun.jdbz2(dxf, new Line(p2, fun.Polar(p2, pi / 2 - 0.01 * pi / 180, 0.1)), new Line(p2, p1), dc/4, 1.2 * scale, 1.6 * scale, 0.9, "GAMF", "", "");
            fun.jdbz2(dxf, new Line(p16, fun.Polar(p16, pi / 2, 0.1)), new Line(p16, p15),  dc / 4.0/2.0, 1.2 * scale, 1.6 * scale, 0.9,"KAPR" , "", "");
            fun.Axis(dxf,v8, 180, -90, "Y", "X", "Z", 0.3 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, p0, 180, -90, "", "", "", 0.3 * scale, 1.2 * scale, 1);
            fun.Axis(dxf, v9 , 180, -90, "Z", "X", "Y", 0.3 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p27, 180, -90, "", "", "", 0.3 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p28, 180, -90, "", "", "", 0.3 * scale, 1.2 * scale, 0);
            fun.Singlelinearrow(dxf, "CCMS", v12, 225, v13 ,v14 , 1.2 * scale, 1.6 * scale);
            fun.Singlelinearrow(dxf, "FDP", v16, 90, v17, v18, 1.2 * scale, 1.6 * scale);

            Line linev1 = new Line(v10, v11);
            Text txt1 = new Text("PCS,MCS,CIP", v11, 1.2 * scale, 0);
            Line linev2 = new Line(v19, v20);
            Text txt2 = new Text("CRP", v21, 1.2 * scale, 0);
            Line linev3 = new Line(v22, v23);
            Text txt3 = new Text("PCS,MCS", v24, 1.2 * scale, 0);
            Line linev4 = new Line(v25, v26);
            Text txt4 = new Text("CIP", v27, 1.2 * scale, 0);
            Line linev5 = new Line(v28, v29);
            Text txt5 = new Text("CRP", v29, 1.2 * scale, 0);
            Text txt6 = new Text("ISYC=308_09", v31, 1.2 * scale, 0);

            dxf.AddEntity(new EntityObject[] { linev1 ,linev2,linev3 ,linev4,linev5 
            ,txt1,txt2 ,txt3 ,txt4,txt5,txt6 
            });


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        //图F.91 ISYC_308_09-可转位刀片心轴连接锯片和锯片铣刀
        public static void ISYC_308_09j(Dictionary<string, Object> data)  //  可转位刀片心轴连接锯片和锯片铣刀
        {

            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan }; //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double sl_ = Convert.ToDouble(data["dc"]);
            double scale = Convert.ToDouble(data["scale"]);
          //   double sl_ = 45;
          //   double scale = 1;
            if (sl_ <= 67)
            {
                scale = 4;
            }
            else if (67 < sl_ && sl_ <= 75)
            {
                scale = 2.5;
            }
            else if (75 < sl_ && sl_ <= 100)
            {
                scale = 2;
            }
            else
            {
                scale = 1;
            }
            /*
            double dc = 40*scale ;
            double cdx = 10 * scale;
            double dbc = 13.33 * scale;
            double dconms = 10 * scale;
            double dah = 1.335 * scale;
            double oal =  4*scale ;
            double apmx = 2.5*scale ;
             */
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double cdx = Convert.ToDouble(data["cdx"]) * scale;
            double dbc = Convert.ToDouble(data["dbc"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double dah = Convert.ToDouble(data["dah"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double apmx = Convert.ToDouble(data["apmx"]) * scale;
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_1 = fun.Polar(p0, pi, dc / 2.0 + 5);
            Vector2 p0_2 = fun.Polar(p0, 0, dc / 2.0 + 5);
            Vector2 p0_5 = fun.Polar(p0, pi / 2, dc / 2.0 + 5);
            Vector2 p0_6 = fun.Polar(p0, pi / -2, dc / 2.0 + 5);
            Circle circle1 = new Circle(Pus.ToV3(p0, 0), dc / 2.0 - dc / 63.0);//圆
            Vector2 p1 = fun.Polar(p0, pi / 2, dc / 2.0);
            Vector2 p2 = fun.Polar(p1, pi / -2, dc / 9.52);
            Vector2 p3 = fun.Polar(p2, fun.CalAngle(p0, p1) + pi / 2, (dc / 9.52 / 2.0));
            Vector2 p4 = fun.Polar(p3, pi / 2, fun.CalDistance(p1, p2) - dc / 63.0);
            Vector2 p5_0 = fun.Polar(p0, pi * 2 / 3.0, dc);
            Arc arc1 = fun.DrawArc4(fun.Polar(p0, pi / 2, circle1.Radius), circle1.Radius, fun.Polar(p0, pi / -2 - 0.1 * pi / 180, circle1.Radius), 0);
            Vector2 p5 = fun.Inters1(p0, p5_0, arc1, 0);
            Vector2 p6 = fun.Polar(p5, -100 * pi / 180, fun.CalDistance(p1, p4) / 2.0);
            Vector2 p7_0 = fun.Polar(p0, 135 * pi / 180, dc);
            Arc arc2 = fun.DrawArc4(p6, fun.CalDistance(p0, p6), fun.Polar(p0, pi, fun.CalDistance(p0, p6)), 0);
            Vector2 p7 = fun.Inters1(p0, p7_0, arc2, 0);
            Vector2 p8 = fun.Polar(p0, pi / 2, dbc / 2.0);
            Vector2 p9 = fun.Polar(p0, 0, dbc / 2.0);
            Vector2 p10 = fun.Polar(p0, pi / -2, dbc / 2.0);
            Vector2 p11 = fun.Polar(p0, pi, dbc / 2.0);
            Vector2 p12_1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p12_2 = fun.Polar(p0, pi / -2, dconms / 2.0);
            Arc arc3 = fun.DrawArc(p12_1, p0, p12_2);
            Vector2 p12_3 = fun.Polar(p0, pi / 2 + pi / 4, dc);
            Vector2 p12 = fun.Inters1(p0, p12_3, arc3, 0);
            Circle circle9 = new Circle(Pus.ToV3(p12, 0), dah * 1.5 / 2);//圆
            Circle circle10 = new Circle(Pus.ToV3(p0, 0), dconms / 2.0);//圆
            Vector2 p13_1 = fun.Polar(p12, pi / 2, circle9.Radius);
            Vector2 p13_2 = fun.Polar(p12, pi / -2, circle9.Radius);
            Arc arc4 = fun.DrawArc(p13_1, p12, p13_2);
            Vector2 p13 = fun.Inters4(arc4, arc3, 1);
            Vector2 p14 = fun.Inters4(arc4, arc3, 0);
            Vector2 p15 = fun.Polar(p1, 0, dc);
            Vector2 p16 = fun.Polar(p15, 0, apmx);
            Vector2 p17 = fun.Polar(p2, 0, dc);
            Vector2 p18 = fun.Polar(p17, 0, apmx);
            Vector2 p0_3 = fun.Polar(p15, pi / -2, dc / 2.0);
            Vector2 p0_4 = fun.Polar(p16, pi / -2, dc / 2.0);
            Vector2 p19_0 = fun.Polar(p15, pi / -2, apmx / 10.0);
            Vector2 p19 = fun.Polar(p19_0, 0, apmx / 10.0);
            Vector2 p20 = fun.Polar(p19, 0, apmx - apmx / 10.0 * 2);
            Vector2 p21_0 = fun.Polar(p19, pi / -2, dc);
            Vector2 p21 = fun.Inters(p0_3, p0_4, p19, p21_0);
            Vector2 p22_0 = fun.Polar(p20, pi / -2, dc);
            Vector2 p22 = fun.Inters(p0_3, p0_4, p20, p22_0);
            Vector2 p23 = fun.Inters(p17, p18, p19, p21);
            Vector2 p24 = fun.Inters(p17, p18, p20, p22);
            Vector2 p25 = fun.Polar(p19, pi / -2, cdx - apmx / 10.0);
            Vector2 p26 = fun.Polar(p20, pi / -2, cdx - apmx / 10.0);
            Vector2 p27 = fun.Polar(p21, pi, (oal - apmx) / 2.0);
            Vector2 p28 = fun.Polar(p22, 0, (oal - apmx) / 2.0);
            Vector2 p29 = fun.Polar(p27, pi / 2, (dc - cdx * 2) / 2.0 - (((dc - cdx * 2) / 2.0) * 1 / 20));
            Vector2 p30 = fun.Polar(p28, pi / 2, (dc - cdx * 2) / 2.0 - (((dc - cdx * 2) / 2.0) * 1 / 20));
            Vector2 p31 = fun.Polar(p22, pi, apmx / 10.0);
            Vector2 p32_0 = fun.Polar(p31, pi / 2, dc);
            Vector2 p32 = fun.Inters(p31, p32_0, p19, p20);
            Vector2 p33 = fun.Polar(p21, pi / 2, fun.CalDistance(p21, p25) / 2.0);
            Vector2 p34 = fun.Polar(p22, pi / 2, fun.CalDistance(p26, p22) / 2.0);

            Vector2 p35 = fun.mirrorpoint(p15, p0_3, p0_4);
            Vector2 p36 = fun.mirrorpoint(p16, p0_3, p0_4);
            Vector2 p37 = fun.mirrorpoint(p17, p0_3, p0_4);
            Vector2 p38 = fun.mirrorpoint(p18, p0_3, p0_4);
            Vector2 p39 = fun.mirrorpoint(p19, p0_3, p0_4);
            Vector2 p40 = fun.mirrorpoint(p20, p0_3, p0_4);
            Vector2 p41 = fun.mirrorpoint(p21, p0_3, p0_4);
            Vector2 p42 = fun.mirrorpoint(p22, p0_3, p0_4);
            Vector2 p43 = fun.mirrorpoint(p23, p0_3, p0_4);
            Vector2 p44 = fun.mirrorpoint(p24, p0_3, p0_4);
            Vector2 p45 = fun.mirrorpoint(p25, p0_3, p0_4);
            Vector2 p46 = fun.mirrorpoint(p26, p0_3, p0_4);
            Vector2 p47 = fun.mirrorpoint(p27, p0_3, p0_4);
            Vector2 p48 = fun.mirrorpoint(p28, p0_3, p0_4);
            Vector2 p49 = fun.mirrorpoint(p29, p0_3, p0_4);
            Vector2 p50 = fun.mirrorpoint(p30, p0_3, p0_4);
            Vector2 p51 = fun.mirrorpoint(p31, p0_3, p0_4);
            Vector2 p52 = fun.Inters(p37, p38, p32, fun.Polar(p32, pi / -2, dc * 1.5));
            Vector2 p53 = fun.mirrorpoint(p33, p0_3, p0_4);
            Vector2 p54 = fun.mirrorpoint(p34, p0_3, p0_4);
            Vector2 p55 = fun.Polar(p29, pi / -2, fun.CalDistance(p29, p27) / 3.0);
            Vector2 p56 = fun.Polar(p55, 0, oal);
            Vector2 p57 = fun.mirrorpoint(p55, p0_3, p0_4);
            Vector2 p58 = fun.mirrorpoint(p56, p0_3, p0_4);
            Line line1 = new Line(p55, p56);
            Line line2 = new Line(p57, p58);
            line1.Layer = refin;//Layer指图层
            line1.LinetypeScale = 5 * scale;//指线性比例
            line1.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            line1.LinetypeScale = 5 / scale;//指线性比例
            line2.Layer = refin;//Layer指图层
            line2.LinetypeScale = 5 * scale;//指线性比例
            line2.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            line2.LinetypeScale = 5 / scale;//指线性比例

            Arc arc5 = fun.DrawArc4(p14, circle9.Radius, p13, 0);
            Arc arc6 = fun.DrawArc(p13, p0, p14);
            Circle circle4 = new Circle(Pus.ToV3(p0, 0), dbc / 2.0);//圆
            circle4.Layer = refin;//Layer指图层
            circle4.LinetypeScale = 5 * scale;//指线性比例
            circle4.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(circle4);
            Circle circle5 = new Circle(Pus.ToV3(p8, 0), dah / 2.0);//圆
            Circle circle6 = new Circle(Pus.ToV3(p9, 0), dah / 2.0);//圆
            Circle circle7 = new Circle(Pus.ToV3(p10, 0), dah / 2.0);//圆
            Circle circle8 = new Circle(Pus.ToV3(p11, 0), dah / 2.0);//圆



            Circle circle2 = new Circle(Pus.ToV3(p0, 0), (dc - cdx * 2) / 2.0);//圆
            Circle circle3 = new Circle(Pus.ToV3(p0, 0), (dc - cdx * 2) / 2.0 - (((dc - cdx * 2) / 2.0) * 1 / 20));//圆
            var polyline1 = Pus.AddPointsToLwPolyLine(p4, p3, p2, p1, p4, p5, p6, p7);
            var polyline2 = Pus.AddPointsToLwPolyLine(p23, p17, p15, p16, p18, p24, p20,p19,  p43, p37, p35, p36, p38,
                p44,  p20, p32, p52, p37, p44, p54, p53, p33, p34);
            polyline1.Vertexes[4].Bulge = Math.Tan((pi / 3) / 4);
            polyline1.Vertexes[6].Bulge = -Math.Tan((120 * pi / 180) / 4);

            fun.Circulararray1(dxf, polyline1, 8, 0.5, contour);
            dxf.AddEntity(new EntityObject[] {polyline2   //polyline1 
            //    ,circle2 ,circle3 ,circle4 ,circle5 ,circle6,circle7 ,circle8  
           //  ,arc5,arc6 
         ,line1,line2
            });
            fun.PolyFill(dxf, polyline1, 0.5, contour);
            fun.PolyFill(dxf, polyline2, 0.5, contour);
         //   fun.drawcircle(dxf, p0, circle2.Radius, 0.5, contour);
         //   fun.drawcircle(dxf, p0, circle3.Radius, 0.5, contour);
            fun.drawcircle(dxf, p8, circle5.Radius, 0.5, contour);
            fun.drawcircle(dxf, p9, circle6.Radius, 0.5, contour);
            fun.drawcircle(dxf, p10, circle7.Radius, 0.5, contour);
            fun.drawcircle(dxf, p11, circle8.Radius, 0.5, contour);
            fun.drawBArc(dxf, arc5, 0.5, contour);
            fun.drawBArc(dxf, arc6, 0.5, contour);

            Line line3 = new Line(p0_1, p0_2);
            line3.Layer = centre;//Layer指图层
            line3.LinetypeScale = 5 * scale;//指线性比例
            line3.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的

            Line line4 = new Line(p0_3, p0_4);
            line4.Layer = centre;//Layer指图层
            line4.LinetypeScale = 5 * scale;//指线性比例
            line4.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的

            Line line5 = new Line(p0_5, p0_6);
            line5.Layer = centre;//Layer指图层
            line5.LinetypeScale = 5 * scale;//指线性比例
            line5.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的

            dxf.AddEntity(new EntityObject[] { line3, line4, line5 });

            //标注

            Vector2 v1 = fun.Polar(p1, pi / -2, dc);
            Vector2 v2 = fun.Polar(p0, pi, dbc / 2.0);
            Vector2 v3 = fun.Polar(v2, 0, dbc);
            Vector2 v4 = fun.Polar(p0, pi, dconms / 2.0);
            Vector2 v5 = fun.Polar(v4, 0, dconms);
            Vector2 v6 = fun.Polar(p11, pi / 2, dah / 2.0);
            Vector2 v7 = fun.Polar(v6, pi / -2, dah);
            Vector2 v8 = fun.Polar(p0, pi + pi / 3, dc);
            Vector2 v9 = fun.Polar(p28, -pi / 3, dc);
            Vector2 v10 = fun.Polar(p0, pi / 2 + pi / 4, 0.3 * 1.7 * scale);
            Vector2 v11 = fun.Polar(v10, pi / 2 + pi / 4, dc / 1.5);
            Vector2 v12 = fun.Polar(p0, pi + pi / 4, dconms / 2.0);
            Vector2 v13 = fun.Polar(v12, pi + pi / 4, dc / 2.0 / 2.0);
            Vector2 v14 = fun.Polar(v13, pi + pi / 4, dc / 2.0 / 2.0);
            Vector2 v16 = fun.Polar(p16, pi / 6, dc / 1.3);
            Vector2 v17 = fun.Polar(v16, pi / -2, dc / 2.0 / 2.0 / 2.0);
            Vector2 v18 = fun.Polar(v17, pi / -2, dc / 2.0 / 2.0 / 2.0);
            Vector2 v19 = fun.Polar(v1, pi + pi / 4, 0.3 * 1.7 * scale);
            Vector2 v20 = fun.Polar(v19, pi + pi / 4, dconms / 4.0);
            Vector2 v21 = fun.Polar(v20, pi / -2, 1.2 * scale);
            Vector2 v22 = fun.Polar(p27, pi + pi / 6, 0.3 * 1.7 * scale);
            Vector2 v23 = fun.Polar(v22, pi + pi / 6, dconms);
            Vector2 v24 = fun.Polar(v23, pi / -2, 1.2 * scale);
            Vector2 v25 = fun.Polar(p28, pi / -4, 0.3 * 1.7 * scale);
            Vector2 v26 = fun.Polar(v25, pi / -4, dconms / 2.0);
            Vector2 v27 = fun.Polar(v26, pi / -2, 1.2 * scale);
            Vector2 v28 = fun.Polar(p36, pi / 4, 0.3 * 1.7 * scale);
            Vector2 v29 = fun.Polar(v28, pi / 4, dconms / 2.0);
            Vector2 v30 = fun.Polar(p0, 0, dc / 2.0);
            Vector2 v31 = fun.Polar(v30, pi / 1.8, dc);

            fun.dimrot1(dxf, p1, v1, -90, dc / 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DC", "", "");
            fun.dimrot1(dxf, v2, v3, 180, dc, 2, 1.2 * scale, 1.6 * scale, 0.9, "DBC", "", "");
            fun.dimrot1(dxf, v4, v5, 180, dc / 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCONMS", "", "");
            fun.dimrot1(dxf, v6, v7, 90, dc / 2, 2, 1.2 * scale, 1.6 * scale, 0.9, "DAH", "", "");
            fun.dimrot1(dxf, p15, p16, 0, dc / 4, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL", "", "");
            fun.dimrot1(dxf, p35, p36, 180, dc / 3.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "CWN,CWX", "", "");
            fun.jdbz2(dxf, new Line(p2, fun.Polar(p2, pi / 2 - 0.01 * pi / 180, 0.1)), new Line(p2, p1), dc / 4, 1.2 * scale, 1.6 * scale, 0.9, "GAMF", "", "");
            fun.jdbz2(dxf, new Line(p16, fun.Polar(p16, pi / 2, 0.1)), new Line(p16, p15), dc / 4.0 / 2.0, 1.2 * scale, 1.6 * scale, 0.9, "KAPR", "", "");

            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }                                                             
}                                                                 
 